Advertisement
juanpecea

IPSec

Apr 27th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.63 KB | None | 0 0
  1. ##########################################################################################################
  2. Pregunta 1:
  3.  
  4. Antes de configurar el Wireshark con las claves usadas en las Security Associations, enumera qué campos se pueden ver de la cabecera AH y de la cabecera ESP:
  5.  
  6. Authentication Header
  7. Next Header: Encap Security Payload (0x32)
  8. Length: 24
  9. AH SPI: 0x00000200
  10. AH Sequence: 1
  11. AH ICV: a1213e0fa0fc55295ae42b39
  12.  
  13. Encapsulating Security Payload
  14. ESP SPI: 0x00000201 (513)
  15. ESP Sequence: 1
  16.  
  17. ##########################################################################################################
  18. Pregunta 2:
  19.  
  20. ¿Qué es el campo SPI y para qué sirve? ¿Qué tamaño tiene (en bytes)?
  21.  
  22. El campo SPI(Security Parameters Index) identifica una asociación de seguridad y tiene una longitud de 4bytes.
  23.  
  24. ##########################################################################################################
  25. Pregunta 3:
  26.  
  27. Para los siguientes SPI, identifica dirección de origen, destino, y protocolo asociado (AH o ESP): SPI 0x200, SPI 0x201, SPI 0x300, SPI 0x301:
  28.  
  29. SPI 0x200
  30. Dirección origen: 192.168.177.47
  31. Dirección destino: 192.168.177.48
  32. Protocolo asociado: AH
  33.  
  34. SPI 0x201
  35. Dirección origen: 192.168.177.47
  36. Dirección destino: 192.168.177.48
  37. Protocolo asociado: ESP
  38.  
  39. SPI 0x300
  40. Dirección origen: 192.168.177.48
  41. Dirección destino: 192.168.177.47
  42. Protocolo asociado: AH
  43.  
  44. SPI 0x301
  45. Dirección origen: 192.168.177.48
  46. Dirección destino: 192.168.177.47
  47. Protocolo asociado: ESP
  48.  
  49. ##########################################################################################################
  50. Pregunta 4:
  51.  
  52. ¿Para qué sirve el campo Sequence?
  53.  
  54. Se trata de un valor monótono creciente con una longitud de 32 bits. Proporciona una función anti-repetición para evitar posibles ataques de este tipo.
  55.  
  56. ##########################################################################################################
  57. Pregunta 5:
  58.  
  59. En la cabecera AH, ¿Qué es el campo AH ICV?
  60.  
  61. Se trata del valor de Comprobación de Integridad (Integrity Check Value, ICV) es un campo de longitud variable (debe ser un número de palabras de 32 bits) normalmente un hash MD5 o SHA-1 y su función es detectar cambios accidentales en una secuencia de datos para proteger la integridad de estos.
  62.  
  63. Se transmite el dato junto con su valor hash, de esta forma el receptor puede calcular dicho valor y compararlo así con el valor hash recibido.
  64.  
  65.  
  66. ##########################################################################################################
  67. Pregunta 6:
  68.  
  69. Configura el Wireshark con las claves para ESP usadas en las Security Associations. ¿Qué campos nuevos aparecen?
  70.  
  71. Encapsulating Security Payload
  72. ESP IV: cd8bf606c2de5f1c
  73. Pad
  74. ESP Pad Length: 6
  75. Next header: ICMP (0x01)
  76. NULL Authentication
  77. Good: True
  78. Bad: False
  79.  
  80. Internet Control Message Protocol
  81. Type: 8 (Echo (ping) request)
  82. Code: 0
  83. Checksum: 0x03b8 [correct]
  84. Identifier (BE): 1892 (0x0764)
  85. Identifier (LE): 25607 (0x6407)
  86. Sequence number (BE): 1 (0x0001)
  87. Sequence number (LE): 256 (0x0100)
  88. Response frame: 2
  89. Timestamp from icmp data: May 12, 2014 19:24:46.000000000 Hora de verano romance
  90. Timestamp from icmp data (relative): 0.311063000 seconds
  91. Data (48 bytes)
  92. Data: dab8040000000000101112131415161718191a1b1c1d1e1f...
  93. Length: 48
  94. ##########################################################################################################
  95. ?????????????¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿
  96. Pregunta 7:
  97.  
  98. ¿Qué es el campo "ESP IV"? ¿Para qué sirve? ¿Porqué tiene esa longitud?
  99.  
  100. El campo ESP IV(ESP Initialization Vector) es un vector de iniciación que sirve para
  101.  
  102. ????
  103. ESP IV: d84064061c1dbc13
  104.  
  105. ##########################################################################################################
  106.  
  107. Pregunta 8:
  108.  
  109. ¿Porqué es necesario usar Padding? ¿Cómo es el método de Padding usado en la cabecera ESP?
  110.  
  111. El padding es un espacio adicional que se incluye porque los algoritmos criptográficos basados en bloque pueden requerir espacios diferentes. Al utilizar padding se aumentan los datos de la carga útil hasta el tamaño que tenga un bloque cifrado, quedando así alineado con el siguiente campo.
  112.  
  113. El método de padding utilizado en la cabecera ESP (01 02 03 04 05 06) parece coincidir con ISO 10126 donde observamos el valor 06 que indica la longitud en el ultimo byte, aunque el resto de byte no parecen ser aleatorios no corresponde con ningún otro esquema estudiado.
  114.  
  115. ##########################################################################################################
  116. ##########################################################################################################
  117.  
  118. Problema practica: estaba esp+ah y cogia ese spi antes que coger solo esp (conflicto de spi)
  119.  
  120.  
  121. Ejercicio 2:
  122.  
  123. 192.168.177.91 192.168.177.75 ah 0x01020091 0xd2516046225083dc1a1a30b8d65ac606
  124. 192.168.177.91 192.168.177.75 esp 0x02020091 0xf64ddcd81e590e83b8a6805acf1291ea
  125. 192.168.177.91 192.168.177.75 esp+a 0x03020091 0xac3400064f903a62741ae7c76efacaf0
  126.  
  127. ----------------------------------------------------------------------------------
  128.  
  129. 192.168.177.75 192.168.177.91 ah!!! 0x01010091 0xa9058df93e2c80490d318372d141dc18
  130. 192.168.177.75 192.168.177.91 esp!! 0x02010091 0x12358262f472ece07311286c3cd755d6
  131. 192.168.177.75 192.168.177.91 esp+a 0x03010091 0x0218ea14d76ba63246c460ad65e13992
  132.  
  133. #######################################################################
  134.  
  135. ping 192.168.177.75
  136.  
  137. Ejercicio 2: nano /etc/ipsec-tools.conf
  138.  
  139.  
  140. # Security Policies
  141.  
  142. spdadd 192.168.177.91 192.168.177.75 any
  143. -P out ipsec
  144. esp/transport//require;
  145.  
  146. spdadd 192.168.177.75 192.168.177.91 any
  147. -P in ipsec
  148. esp/transport//require;
  149.  
  150. #Security Associations
  151.  
  152. add 192.168.177.75 192.168.177.91 esp 0x02010091
  153. -m transport -r 4
  154. -E aes-cbc 0x12358262f472ece07311286c3cd755d6;
  155. add 192.168.177.91 192.168.177.75 esp 0x02020091
  156. -m transport -r 4
  157. -E aes-cbc 0xf64ddcd81e590e83b8a6805acf1291ea;
  158.  
  159. #######################################################################
  160. Filtro wireshark:
  161.  
  162. ip.addr==192.168.177.92
  163.  
  164. #######################################################################
  165. sudo nano /etc/network/interfaces
  166.  
  167.  
  168. # This file describes the network interfaces available on your system
  169. # and how to activate them. For more information, see interfaces(5).
  170.  
  171. # The loopback network interface
  172. auto lo
  173. iface lo inet loopback
  174.  
  175. # The primary network interface
  176. auto eth0
  177. iface eth0 inet static
  178. address 192.168.177.91
  179. netmask 255.255.254.0
  180. gateway 192.168.177.254
  181. dns-nameservers 150.214.57.7 150.214.57.8 150.214.40.11 150.214.40$
  182. #iface eth0 inet dhcp
  183.  
  184. ############################################
  185. sudo /etc/init.d/networking restart
  186. sudo reboot
  187.  
  188. ###############################################
  189. ifconfig
  190.  
  191. eth0 Link encap:Ethernet HWaddr 00:0c:29:2f:9b:9f
  192. inet addr:192.168.177.91 Bcast:192.168.177.255 Mask:255.255.254.0
  193. inet6 addr: fe80::20c:29ff:fe2f:9b9f/64 Scope:Link
  194. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  195. RX packets:779 errors:0 dropped:0 overruns:0 frame:0
  196. TX packets:140 errors:0 dropped:0 overruns:0 carrier:0
  197. collisions:0 txqueuelen:1000
  198. RX bytes:71383 (71.3 KB) TX bytes:16275 (16.2 KB)
  199.  
  200. lo Link encap:Local Loopback
  201. inet addr:127.0.0.1 Mask:255.0.0.0
  202. inet6 addr: ::1/128 Scope:Host
  203. UP LOOPBACK RUNNING MTU:65536 Metric:1
  204. RX packets:50 errors:0 dropped:0 overruns:0 frame:0
  205. TX packets:50 errors:0 dropped:0 overruns:0 carrier:0
  206. collisions:0 txqueuelen:0
  207. RX bytes:4478 (4.4 KB) TX bytes:4478 (4.4 KB)
  208.  
  209.  
  210. ####################################################
  211. root@ubuntu:/home/alumno# ping 192.168.177.166
  212. root@ubuntu:/home/alumno# /etc/ipsec-tools.conf
  213. root@ubuntu:/home/alumno# nano /etc/ipsec-tools.conf
  214.  
  215. ###########################################
  216. /etc/ipsec-tools.conf
  217. ###########################################
  218.  
  219. #!/usr/sbin/setkey -f
  220.  
  221. # NOTE: Do not use this file if you use racoon with racoon-tool
  222. # utility. racoon-tool will setup SAs and SPDs automatically using
  223. # /etc/racoon/racoon-tool.conf configuration.
  224. #
  225.  
  226. ## Flush the SAD and SPD
  227.  
  228. flush;
  229. spdflush;
  230.  
  231. # Security Policies
  232. spdadd 192.168.177.12 192.168.177.166 any
  233. -P out ipsec
  234. esp/transport//require;
  235.  
  236. # Security Policies
  237. spdadd 192.168.177.166 192.168.177.12 any
  238. -P in ipsec
  239. esp/transport//require;
  240.  
  241.  
  242. # Security Associations
  243. add 192.168.177.12 192.168.177.166 esp 0x12345678
  244. -m transport -r 4
  245. -E aes-cbc 0x56fec3445ff820f116f8701e1abf6c37;
  246.  
  247.  
  248.  
  249. add 192.168.177.166 192.168.177.12 esp 0x12345678
  250. -m transport -r 4
  251. -E aes-cbc 0x56fec3445ff820f116f8701e1abf6c37;
  252.  
  253. ##################################################################
  254.  
  255.  
  256. root@ubuntu:/home/alumno# setkey -D
  257. 192.168.177.166 192.168.177.12
  258. ah mode=transport spi=305419896(0x12345678) reqid=0(0x00000000)
  259. A: hmac-sha1 b9bf971b dab9a41d 5ceb2ae4 641dd215 101f44a8
  260. seq=0x00000000 replay=4 flags=0x00000000 state=mature
  261. created: Apr 27 02:09:59 2015 current: Apr 27 02:20:25 2015
  262. diff: 626(s) hard: 0(s) soft: 0(s)
  263. last: Apr 27 02:13:47 2015 hard: 0(s) soft: 0(s)
  264. current: 3008(bytes) hard: 0(bytes) soft: 0(bytes)
  265. allocated: 47 hard: 0 soft: 0
  266. sadb_seq=1 pid=2098 refcnt=0
  267. 192.168.177.12 192.168.177.166
  268. ah mode=transport spi=305419896(0x12345678) reqid=0(0x00000000)
  269. A: hmac-sha1 b9bf971b dab9a41d 5ceb2ae4 641dd215 101f44a8
  270. seq=0x00000000 replay=4 flags=0x00000000 state=mature
  271. created: Apr 27 02:09:59 2015 current: Apr 27 02:20:25 2015
  272. diff: 626(s) hard: 0(s) soft: 0(s)
  273. last: Apr 27 02:10:21 2015 hard: 0(s) soft: 0(s)
  274. current: 3456(bytes) hard: 0(bytes) soft: 0(bytes)
  275. allocated: 54 hard: 0 soft: 0
  276. sadb_seq=0 pid=2098 refcnt=0
  277.  
  278.  
  279. ##########################################################################
  280.  
  281.  
  282. root@ubuntu:/home/alumno# setkey -DP
  283. 192.168.177.166[any] 192.168.177.12[any] 255
  284. fwd prio def ipsec
  285. ah/transport//require
  286. created: Apr 27 02:09:59 2015 lastused:
  287. lifetime: 0(s) validtime: 0(s)
  288. spid=1058 seq=1 pid=2099
  289. refcnt=1
  290. 192.168.177.166[any] 192.168.177.12[any] 255
  291. in prio def ipsec
  292. ah/transport//require
  293. created: Apr 27 02:09:59 2015 lastused: Apr 27 02:14:30 2015
  294. lifetime: 0(s) validtime: 0(s)
  295. spid=1048 seq=2 pid=2099
  296. refcnt=1
  297. 192.168.177.12[any] 192.168.177.166[any] 255
  298. out prio def ipsec
  299. ah/transport//require
  300. created: Apr 27 02:09:59 2015 lastused: Apr 27 02:14:30 2015
  301. lifetime: 0(s) validtime: 0(s)
  302. spid=1041 seq=3 pid=2099
  303. refcnt=1
  304. (per-socket policy)
  305. out(socket) none
  306. created: Apr 27 00:20:27 2015 lastused:
  307. lifetime: 0(s) validtime: 0(s)
  308. spid=156 seq=4 pid=2099
  309. refcnt=1
  310. (per-socket policy)
  311. in(socket) none
  312. created: Apr 27 00:20:27 2015 lastused:
  313. lifetime: 0(s) validtime: 0(s)
  314. spid=147 seq=5 pid=2099
  315. refcnt=1
  316. (per-socket policy)
  317. out(socket) none
  318. created: Apr 27 00:20:27 2015 lastused:
  319. lifetime: 0(s) validtime: 0(s)
  320. spid=140 seq=6 pid=2099
  321. refcnt=1
  322. (per-socket policy)
  323. in(socket) none
  324. created: Apr 27 00:20:27 2015 lastused:
  325. lifetime: 0(s) validtime: 0(s)
  326. spid=131 seq=7 pid=2099
  327. refcnt=1
  328. (per-socket policy)
  329. out(socket) none
  330. created: Apr 27 00:20:24 2015 lastused:
  331. lifetime: 0(s) validtime: 0(s)
  332. spid=124 seq=8 pid=2099
  333. refcnt=1
  334. (per-socket policy)
  335. in(socket) none
  336. created: Apr 27 00:20:24 2015 lastused:
  337. lifetime: 0(s) validtime: 0(s)
  338. spid=115 seq=9 pid=2099
  339. refcnt=1
  340. (per-socket policy)
  341. out(socket) none
  342. created: Apr 27 00:20:24 2015 lastused:
  343. lifetime: 0(s) validtime: 0(s)
  344. spid=108 seq=10 pid=2099
  345. refcnt=1
  346. (per-socket policy)
  347. in(socket) none
  348. created: Apr 27 00:20:24 2015 lastused:
  349. lifetime: 0(s) validtime: 0(s)
  350. spid=99 seq=11 pid=2099
  351. refcnt=1
  352. (per-socket policy)
  353. out(socket) none
  354. created: Apr 27 00:20:24 2015 lastused:
  355. lifetime: 0(s) validtime: 0(s)
  356. spid=92 seq=12 pid=2099
  357. refcnt=1
  358. (per-socket policy)
  359. in(socket) none
  360. created: Apr 27 00:20:24 2015 lastused:
  361. lifetime: 0(s) validtime: 0(s)
  362. spid=83 seq=13 pid=2099
  363. refcnt=1
  364. (per-socket policy)
  365. out(socket) none
  366. created: Apr 27 00:20:24 2015 lastused:
  367. lifetime: 0(s) validtime: 0(s)
  368. spid=76 seq=14 pid=2099
  369. refcnt=1
  370. (per-socket policy)
  371. in(socket) none
  372. created: Apr 27 00:20:24 2015 lastused:
  373. lifetime: 0(s) validtime: 0(s)
  374. spid=67 seq=15 pid=2099
  375. refcnt=1
  376. (per-socket policy)
  377. out(socket) none
  378. created: Apr 27 00:20:24 2015 lastused:
  379. lifetime: 0(s) validtime: 0(s)
  380. spid=60 seq=16 pid=2099
  381. refcnt=1
  382. (per-socket policy)
  383. in(socket) none
  384. created: Apr 27 00:20:24 2015 lastused:
  385. lifetime: 0(s) validtime: 0(s)
  386. spid=51 seq=17 pid=2099
  387. refcnt=1
  388. (per-socket policy)
  389. out(socket) none
  390. created: Apr 27 00:20:24 2015 lastused:
  391. lifetime: 0(s) validtime: 0(s)
  392. spid=44 seq=18 pid=2099
  393. refcnt=1
  394. (per-socket policy)
  395. in(socket) none
  396. created: Apr 27 00:20:24 2015 lastused:
  397. lifetime: 0(s) validtime: 0(s)
  398. spid=35 seq=19 pid=2099
  399. refcnt=1
  400. (per-socket policy)
  401. out(socket) none
  402. created: Apr 27 00:20:24 2015 lastused:
  403. lifetime: 0(s) validtime: 0(s)
  404. spid=28 seq=20 pid=2099
  405. refcnt=1
  406. (per-socket policy)
  407. in(socket) none
  408. created: Apr 27 00:20:24 2015 lastused:
  409. lifetime: 0(s) validtime: 0(s)
  410. spid=19 seq=21 pid=2099
  411. refcnt=1
  412. (per-socket policy)
  413. out(socket) none
  414. created: Apr 27 00:20:24 2015 lastused:
  415. lifetime: 0(s) validtime: 0(s)
  416. spid=12 seq=22 pid=2099
  417. refcnt=1
  418. (per-socket policy)
  419. in(socket) none
  420. created: Apr 27 00:20:24 2015 lastused:
  421. lifetime: 0(s) validtime: 0(s)
  422. spid=3 seq=0 pid=2099
  423. refcnt=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement