Você está na página 1de 11

QUEBRANDO A SENHA DE ROTE...

OBJETIVO (captulo Introduo)

Por padro os roteadores Cisco da linha Enterprise (pr-ISR, ISR-G1 e ISR-G2) no possuem
senhas, porm muitas vezes nos vemos em uma situao onde temos que assumir uma
infraestrutura j montada ou realocar equipamentos pr-configurados sem conhecermos as
senhas de login e enable.

Veja na figura abaixo uma evoluo das linhas de roteadores Cisco onde esse procedimento se
aplica.

justamente nesse tipo de situao que oprocedimento de quebra de senhas (chamado


depassword recovery) entra em ao.

O objetivo desse Tech Note, portanto, apresentar e demonstrar o processo de recuperao


ou quebra de senha em roteadores Cisco que rodam o Cisco IOS verses 12.x e 15.x.

Juntamente com o passo a passo vamos discutir os principais problemas podem ocorrer em
campo, assim como evit-los.

Autor: Prof. Marcelo Nascimento

PASSO 1 (captulo Passo a Passo)

Abra uma sesso do terminal com o cabo de console conectado ao roteador


Reinicie o roteador fisicamente no boto de ON/OFF.

O passo-2 deve ser realizado nos primeiros segundos da reinicializaro, por isso antes de
tentar realizar leia o passo-2 primeiro.

PASSO 2 (captulo Passo a Passo)

Fazer o roteador entrar em Rommon.

Para isso, aps 5 segundos aproximadamente, pressionar simultaneamente as teclas ctrl +


break do teclado do computador ou laptop conectado via console ao roteador. Este
procedimento interrompe a seqncia normal do boot e inicia o Rom Monitor, no prompt
conforme abaixo.
PASSO 3 (captulo Passo a Passo)

Alterar o registro de configurao para 02142 e resetar o roteador.

Ainda em rommon necessrio alterar o registro de configurao para que o roteador seja
reinicializado sem carregar sua configurao contida na NVRAM (startup-config), desta forma
nenhuma senha ser carregada e o roteador iniciar em modo setup como se estivesse
zerado.

rommon 1 > confreg 02142

Em routers mais antigos o comando pode ser o/r 02142.

Em seguida reinicialize o roteador com o registro novo.

rommon 2 > reset

O comando i tambm tem a mesma funo do reset.

PASSO 4 (captulo Passo a Passo)

Passos ps-reinicializao: Sair do modo setup e no apagar a configurao


armazenada na NVRAM (Startup-config).

Aps reinicializar o roteador, ele ser carregado sem nenhuma configurao. Isso no
significa que a configurao foi apagada, apenas significa que ela no foi carregada e
continua presente na NVRAM. Voc pode verificar com o comando show startup-config.
Na inicializao, pelo motivo do roteador estar aparentemente sem nada na memria de
inicializao (NVRAM), ele vem com a pergunta para iniciar o Setup Dialog. Responda que
no (no ou N) para ter acesso ao CLI.

Would you like to enter the initial configuration dialog? [yes/no]:N

Digite no, n ou pressione as teclas control+C.

PASSO 5 (captulo Passo a Passo)

Voltar a configurao original na Running-config.

Em seguida carregue o arquivo de configurao original gravado na NVRAM dentro da


memria RAM (Running-config) para que o roteador volte ao estado anterior e voc no perca
nada:

router>enable
router#copy startup-config running-config

O router no pedir senha, pois ainda no foi carregada na configurao, porm no salve
nada ainda nem saia do modo privilegiado, ainda no finalizamos o processo.

Se voc simplesmente no precisar da configurao original e deseja "zerar" o roteador (voltar


as configuraes de fbrica) s no salvar o contedo da Startup-config na memria RAM e
passar direto para o Passo 7.

PASSO 6 (captulo Passo a Passo)

Trocar as senhas e verificar se preciso tirar as interfaces de shutdown.

No podemos esquecer de alterar as senhas (enable, console e VTY) antes de gravar a


configurao novamente na NVRAM, seno todo processo "vai por gua abaixo".

Router#config term
Router(config)#enable secret troque-a-senha
Router(config)#username seja-qual-for secret troque-a-senha
Router(config)#line console 0
Router(config-line)#password troque-a-senha

Outro ponto que como o processo de copiar da NVRAM para a RAM faz um merge (mescla
os arquivos), normalmente alm do procedimento acima necessrio tirar as interfaces que
esto sendo utilizadas de shutdown caso elas tenham sido desabilitadas, basta dar um "show
ip interface brief" e confirmar.

PASSO 7 (captulo Passo a Passo)

Voltar o registro de configurao para o valor padro (02102) e gravar a configurao.

Aps tirar as interfaces de shutdown, voc deve voltar o registro para o padro normal para
que ele desta vez carregue o arquivo de configurao.
O cdigo de registro 02142 faz que o roteador ignore o arquivo de backup contido na NVRAM.
O registro02102 que o padro, carrega o arquivo de backup da NVRAM para a
memria RAM.

router(config)#config-register 02102
router#copy running-config startup-config
router#reload

Para verificar se o valor do registro de configurao est correto aps a inicializao utilize o
comando show version.

Note que foi recomendado um reload no final, porm ele opcional, pois com o procedimento
realizado tudo j estar funcionando normalmente.

ENTENDENDO E EVITANDO PROBLEMAS (captulo Evitando Problemas)

Abaixo segue uma lista bem prtica dos principais problemas que voc pode enfrentar ao fazer
uma recuperao de senha e vou passar dicas de como evit-los:

1. Aparecem smbolos estranhos no terminal ao conectar o cabo de console:


verifique a velocidade do terminal, por padro ele 9600bps, mas pode ir at 115200bps.
Voc pode ir aumentando gradualmente a velocidade at chegar no valor correto.

2. Toda vez que o roteador reinicializa ele volta zerado com a mensagem do Setup
Inicial: voc esqueceu do passo 7 e no voltou o registro de configurao para o valor
padro de 0x2102. Reveja o passo 7 e salve sua configurao.

3. Perdi a configurao original do roteador: se voc no fez corretamente os passos


5, 6 e 7 e esqueceu de gravar a configurao original infelizmente no tem como
recuperar. Voc deve procurar um backup nos arquivos da empresa ou reconfigurar do
zero o roteador.

4. O processo de recuperao com Control+Break no parece estar funcionando,


nada ocorre quando entro com o comando no teclado: provavelmente a recuperao
de senha est desativada pelo "no service password-recovery". Esse comando no
disponibilizado em todas as verses de Cisco IOS, normalmente est disponvel em
modelos mais antigos.

5. EXEMPLO PRTICO (captulo Exemplo Prtico)


6.
7. Veja abaixo um exemplo com o passo a passo de recuperao da senha em um roteador
modelo 2921. Onde estiver grifado so os momentos de entrar com as informaes
mostradas nesse Tech Note.
8. Note que os dois primeiros passos grifados so apenas a confirmao que no temos a
senha e depois uma visualizao dos dados gerais do roteador com um "show version".
Na sequncia vem o procedimento de quebra de senha.
9. Router>enable
10. Password:
11. Password:
12. Password:
13. % Bad secrets
14.
15. Router>show version
16. Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version
15.0(1)M1,
17. RELEASE SOFTWARE (fc1)
18. Technical Support: http://www.cisco.com/techsupport
19. Copyright (c) 1986-2009 by Cisco Systems, Inc.
20. Compiled Wed 02-Dec-09 15:23 by prod_rel_team
21.
22. ROM: System Bootstrap, Version 15.0(1r)M1, RELEASE SOFTWARE (fc1)
23.
24. c2921-CCP-1-xfr uptime is 2 weeks, 22 hours, 15 minutes
25. System returned to ROM by reload at 06:06:52 PCTime Mon Apr 2 1900
26. System restarted at 06:08:03 PCTime Mon Apr 2 1900
27. System image file is "flash:c2900-universalk9-mz.SPA.150-1.M1.bin"
28. Last reload reason: Reload Command
29.
30.
31. This product contains cryptographic features and is subject to United
32. States and local country laws governing import, export, transfer and
33. use. Delivery of Cisco cryptographic products does not imply
34. third-party authority to import, export, distribute or use encryption.
35. Importers, exporters, distributors and users are responsible for
36. compliance with U.S. and local country laws. By using this product you
37. agree to comply with applicable laws and regulations. If you are unable
38. to comply with U.S. and local laws, return this product immediately.
39.
40. A summary of U.S. laws governing Cisco cryptographic products may be found
at:
41. http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
42.
43. If you require further assistance please contact us by sending email to
44. export@cisco.com.
45.
46. Cisco CISCO2921/K9 (revision 1.0) with 475136K/49152K bytes of memory.
47. Processor board ID FHH1230P04Y
48. 1 DSL controller
49. 3 Gigabit Ethernet interfaces
50. 9 terminal lines
51. 1 Virtual Private Network (VPN) Module
52. 1 Cable Modem interface
53. 1 cisco Integrated Service Engine-2(s)
54. Cisco Foundation 2.2.1 in slot 1
55. DRAM configuration is 64 bits wide with parity enabled.
56. 255K bytes of non-volatile configuration memory.
57. 248472K bytes of ATA System CompactFlash 0 (Read/Write)
58. 62720K bytes of ATA CompactFlash 1 (Read/Write)
59.
60. Technology Package License Information for Module:'c2900'
61.
62. ----------------------------------------------------------------
63. Technology Technology-package Technology-package
64. Current Type Next reboot
65. -----------------------------------------------------------------
66. ipbase ipbasek9 Permanent ipbasek9
67. security securityk9 Permanent securityk9
68. uc uck9 Permanent uck9
69. data datak9 Permanent datak9
70.
71. Configuration register is 0x2102
72.
73.
74. Router>
75.
76.
77.
78.!--- Aqui o roteador foi reiniciado fisicamente pelo boto de
liga/desliga
79.!--- A sequncia de break foi inserida aps a mensagem:
80. !--- "program load complete, entry point: 0x80008000, size:
0x6fdb4c."
81.
82.
83. !
84.
85. rommon 1 > confreg 0x2142
86.
87. You must reset or power cycle for new config to take effect
88.
89. rommon 2 > reset
90.
91. System Bootstrap, Version 15.0(1r)M1, RELEASE SOFTWARE (fc1)
92. Copyright (c) 2009 by cisco Systems, Inc.
93. TAC:Home:SW:IOS:Specials for info
94. C2900 platform with 524288 Kbytes of main memory
95.
96.
97. program load complete, entry point: 0x80008000, size: 0x6fdb4c
98.
99. Self decompressing the image :
###############################
100. ##############################################
################
101. ##############################################
################
102. ##############################################
################
103. ############################### [OK]
104.
105.
106. Restricted Rights Legend
107.
108. Use, duplication, or disclosure by the Government is
109. subject to restrictions as set forth in subparagraph
110. (c) of the Commercial Computer Software - Restricted
111. Rights clause at FAR sec. 52.227-19 and subparagraph
112. (c) (1) (ii) of the Rights in Technical Data and Computer
113. Software clause at DFARS sec. 252.227-7013.
114.
115. cisco Systems, Inc.
116. 170 West Tasman Drive
117. San Jose, California 95134-1706
118.
119. Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version
15.0(1)M1,
120. RELEASE SOFTWARE (fc1)
121. Technical Support: http://www.cisco.com/techsupport
122. Copyright (c) 1986-2009 by Cisco Systems, Inc.
123. Compiled Wed 02-Dec-09 15:23 by prod_rel_team
124.
125. Cisco CISCO2921/K9 (revision 1.0) with 475136K/49152K bytes of memory.
126. Processor board ID FHH1230P04Y
127. 1 DSL controller
128. 3 Gigabit Ethernet interfaces
129. 9 terminal lines
130. 1 Virtual Private Network (VPN) Module
131. 1 Cable Modem interface
132. 1 cisco Integrated Service Engine-2(s)
133. Cisco Foundation 2.2.1 in slot 1
134. DRAM configuration is 64 bits wide with parity enabled.
135. 255K bytes of non-volatile configuration memory.
136. 248472K bytes of ATA System CompactFlash 0 (Read/Write)
137. 62720K bytes of ATA CompactFlash 1 (Read/Write)
138.
139.
140. --- System Configuration Dialog ---
141.
142. Would you like to enter the initial configuration dialog? [yes/no]: n
143.
144. Press RETURN to get started!
145.
146. 00:00:19: %LINK-3-UPDOWN: Interface BRI0/0, changed state to up
147. 00:00:19: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
148. 00:00:19: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up
149. 00:00:19: %LINK-3-UPDOWN: Interface Serial0/0, changed state to down
150. 00:00:19: %LINK-3-UPDOWN: Interface Serial0/1, changed state to down
151. 00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0/0,
152. changed state to down
153. 00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0,
154. changed state to up
155. Router>
156. 00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1,
157. changed state to up
158. 00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0,
159. changed state to down
160. 00:00:20: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1,
161. changed state to down
162. 00:00:50: %SYS-5-RESTART: System restarted --
163. Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version
15.0(1)M1,
164. RELEASE SOFTWARE (fc1)
165. Technical Support: http://www.cisco.com/techsupport
166. Copyright (c) 1986-2009 by Cisco Systems, Inc.
167. Compiled Wed 02-Dec-09 15:23 by prod_rel_team
168. 00:00:50: %LINK-5-CHANGED: Interface BRI0/0,
169. changed state to administratively down
170. 00:00:52: %LINK-5-CHANGED: Interface Ethernet0/0,
171. changed state to administratively down
172. 00:00:52: %LINK-5-CHANGED: Interface Serial0/0,
173. changed state to administratively down
174. 00:00:52: %LINK-5-CHANGED: Interface Ethernet0/1,
175. changed state to administratively down
176. 00:00:52: %LINK-5-CHANGED: Interface Serial0/1,
177. changed state to administratively down
178. 00:00:53: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0,
179. changed state to down
180. 00:00:53: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1,
181. changed state to down
182. Router>
183. Router>enable
184. Router#copy startup-config running-config
185. Destination filename [running-config]?
186. 1324 bytes copied in 2.35 secs (662 bytes/sec)
187. Router#
188. 00:01:24: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0/0:1,
189. changed state to down
190. 00:01:24: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0/0:2,
191. changed state to down
192. Router#configure terminal
193. Enter configuration commands, one per line. End with CNTL/Z.
194. Router(config)#enable secret < troque-a-senha >
195. Router(config)#^Z
196. 00:01:54: %SYS-5-CONFIG_I: Configured from console by console
197. Router#show ip interface brief
198.
199. Interface IP-Address OK? Method Status Protocol
200. Ethernet0/0 10.200.40.37 YES TFTP administratively down down
201. Serial0/0 unassigned YES TFTP administratively down down
202. BRI0/0 193.251.121.157 YES unset administratively down down
203. BRI0/0:1 unassigned YES unset administratively down down
204. BRI0/0:2 unassigned YES unset administratively down down
205. Ethernet0/1 unassigned YES TFTP administratively down down
206. Serial0/1 unassigned YES TFTP administratively down down
207. Loopback0 193.251.121.157 YES TFTP up up
208. Router#configure terminal
209. Enter configuration commands, one per line. End with CNTL/Z.
210. Router(config)#interface Ethernet0/0
211. Router(config-if)#no shutdown
212. Router(config-if)#
213. 00:02:14: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
214. 00:02:15: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0,
215. changed state to up
216. Router(config-if)#interface BRI0/0
217. Router(config-if)#no shutdown
218. Router(config-if)#
219. 00:02:26: %LINK-3-UPDOWN: Interface BRI0/0:1, changed state to down
220. 00:02:26: %LINK-3-UPDOWN: Interface BRI0/0:2, changed state to down
221. 00:02:26: %LINK-3-UPDOWN: Interface BRI0/0, changed state to up
222. 00:02:115964116991: %ISDN-6-LAYER2UP: Layer 2 for Interface BR0/0,
223. TEI 68 changed to up
224. Router(config-if)#^Z
225. Router#
226. 00:02:35: %SYS-5-CONFIG_I: Configured from console by console
227. Router#copy running-config startup-config
228. Destination filename [startup-config]?
229. Building configuration...
230. [OK]
231. Router#show version
232. Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version
15.0(1)M1,
233. RELEASE SOFTWARE (fc1)
234. Technical Support: http://www.cisco.com/techsupport
235. Copyright (c) 1986-2009 by Cisco Systems, Inc.
236. Compiled Wed 02-Dec-09 15:23 by prod_rel_team
237.
238. ROM: System Bootstrap, Version 15.0(1r)M1, RELEASE SOFTWARE (fc1)
239.
240. c2921-CCP-1-xfr uptime is 2 weeks, 22 hours, 15 minutes
241. System returned to ROM by reload at 06:06:52 PCTime Mon Apr 2 1900
242. System restarted at 06:08:03 PCTime Mon Apr 2 1900
243. System image file is "flash:c2900-universalk9-mz.SPA.150-1.M1.bin"
244. Last reload reason: Reload Command
245.
246. Cisco CISCO2921/K9 (revision 1.0) with 475136K/49152K bytes of memory.
247. Processor board ID FHH1230P04Y
248. 1 DSL controller
249. 3 Gigabit Ethernet interfaces
250. 9 terminal lines
251. 1 Virtual Private Network (VPN) Module
252. 1 Cable Modem interface
253. 1 cisco Integrated Service Engine-2(s)
254. Cisco Foundation 2.2.1 in slot 1
255. DRAM configuration is 64 bits wide with parity enabled.
256. 255K bytes of non-volatile configuration memory.
257. 248472K bytes of ATA System CompactFlash 0 (Read/Write)
258. 62720K bytes of ATA CompactFlash 1 (Read/Write)
259.
260. Configuration register is 0x2142
261.
262. Router#configure terminal
263. Enter configuration commands, one per line. End with CNTL/Z.
264. Router(config)#config-register 0x2102
265. Router(config)#^Z
266. 00:03:20: %SYS-5-CONFIG_I: Configured from console by console
267.
268. Router#show version
269. Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version
15.0(1)M1,
270. RELEASE SOFTWARE (fc1)
271. Technical Support: http://www.cisco.com/techsupport
272. Copyright (c) 1986-2009 by Cisco Systems, Inc.
273. Compiled Wed 02-Dec-09 15:23 by prod_rel_team
274.
275. ROM: System Bootstrap, Version 15.0(1r)M1, RELEASE SOFTWARE (fc1)
276.
277. c2921-CCP-1-xfr uptime is 2 weeks, 22 hours, 15 minutes
278. System returned to ROM by reload at 06:06:52 PCTime Mon Apr 2 1900
279. System restarted at 06:08:03 PCTime Mon Apr 2 1900
280. System image file is "flash:c2900-universalk9-mz.SPA.150-1.M1.bin"
281. Last reload reason: Reload Command
282.
283. Cisco CISCO2921/K9 (revision 1.0) with 475136K/49152K bytes of memory.
284. Processor board ID FHH1230P04Y
285. 1 DSL controller
286. 3 Gigabit Ethernet interfaces
287. 9 terminal lines
288. 1 Virtual Private Network (VPN) Module
289. 1 Cable Modem interface
290. 1 cisco Integrated Service Engine-2(s)
291. Cisco Foundation 2.2.1 in slot 1
292. DRAM configuration is 64 bits wide with parity enabled.
293. 255K bytes of non-volatile configuration memory.
294. 248472K bytes of ATA System CompactFlash 0 (Read/Write)
295. 62720K bytes of ATA CompactFlash 1 (Read/Write)
296.
297. Configuration register is 0x2142 (will be 0x2102 at next reload)
298.
299. Router#copy running-config startup-config