Tuesday, August 1, 2017

Silently Fixed Unauthorized Command Injection in WAGO PLC Ethernet

It's been almost 4 years I didn't blogged anything on anywhere (shame).

Anyway, recently found Unauthorized Command Injection vulnerability in WAGO PLC's web-based management software. Affected device is here (WAGO 750-8202 PFC200 CS 2ETH RS).

P.S: This is not related with CVE-2016-9362.

You would need following tools if you would like to analyze vulnerability by yourself;
  • Burp Suite 
  • A Web Browser 
  • Binwalk 
  • Code Editor (My fav is Sublime Text, it's so lightweight and have good themes) 
If you fire up your MITM proxy (Burp Suite is my choice) and visit web application, eventually you will notice that application do lots of XML HTTP Requests and one of requested URL is /wbm/configtools.php. That endpoint executes some OS commands and shares output with the web application (I know 90's wants it's vulnerabilities back).

While playing with JSON payload sent to configtools.php endpoint, find out that it's possible to inject OS commands into "parameter" JSON value. Injected commands such as uname -a and id.



Results of executed commands.


Bingo! Easy and quick win against a dummy device web-based management software.

To confirm that critical vulnerability in latest version of firmware, simply downloaded the latest firmware from WAGO's web site, extracted it with binwalk (thanks authors of binwalk) and start to review source code.




In the source code, CallConfigtoolByJson function called to JSON request from browser which later call CallConfigtool function to process "parameter" value in JSON payload.



OK, commments and code fixes show that they found it internally (maybe?) and fixed it silently. Requested old firmwares but they didn't send me yet :)

Saturday, May 11, 2013

MS12-076 Excel SerAuxErrBar Heap Overflow Vulnerability

There was a Heap Overflow vulnerability (CVE-2012-1885) in Excel while parsing SerAuxErrBar structure from xls (Excel's old binary format) files. So I decided to took on it (a little bit analysis). But I faced with reality that there is no public debugging symbols for Excel :( When I read advisory [1] I don't understand anything as always 'cause Microsoft only says "A remote code execution vulnerability exists in the way that Microsoft Excel handles specially crafted Excel files. An attacker who successfully exploited this vulnerability could take..". That's shit description :( Then I look for SerAuxErrBar structure and found something on MSDN that describes this structure [2]. But there was another question. "How one could create SerAuxErrBar structure?".

Thursday, April 11, 2013

Metasploit Framework ile Exploit Gelistirme Sunumu

Uzun bir sure sonra blog yaziyorum sanirim:) Gecenlerde Fatih Ozavci ile Ozgur Yazilim Gunleri 2013'te Metasploit Framework ile Exploit Gelistirme baslikli bir sunum gerceklestirdik. Metasploit Framework yapisi, exploiting (cok yuzeysel) ve ornek moduller uzerinden modul gelistirme konusunda bilgi aktarmaya calistik. Merak edenler icin sunum asagida.

 Ayrica umuyorum tekrar bir seyler yazarim buraya yakin zamanda.

 

Sunday, September 2, 2012

WebKit cssText NULL Ptr Deref

Just tested with Chrome 21.0.1180.89 m (latest version)

Crash moment:
0:000> r
eax=00000000 ebx=015ccfb0 ecx=00000000 edx=0014ea24 esi=01e00440 edi=01e44630
eip=58fcd2a8 esp=0014e8b0 ebp=0014e8b4 iopl=0         nv up ei pl nz na po nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010202
chrome_58bf0000!WebCore::CSSValue::cssText+0x8:
58fcd2a8 8b4804          mov     ecx,dword ptr [eax+4] ds:002b:00000004=????????


PoC:


Same bug in old release (19.0.1084.52) http://pastebin.com/Z0pu9jbE

Tuesday, August 28, 2012

CVE-2012-2760 Session Stealing in mod_auth_openid

As advisory describing, mod_auth_openid is vulnerable to session stealing. Because "Session ids are stored insecurely in /tmp/mod_auth_openid.db (default filename). The db is world readable and the session ids are stored unencrypted." [1]

Yes, this is important issue and file is accessible by local attackers. But more important issue is database file also accessible by remote attackers in some cases (For example, if application have some kind of arbitrary file download/access vulnerability like LFI) because file is located in tmp folder (apache can access tmp directory) and sqlite db is not encrypted.


SQLite is not supporting database file encryption but there are some external libraries that "provides transparent 256-bit AES encryption of database files". [2]

Dear mod_auth_openid developers, you should use database file encryption. :(

[1] http://seclists.org/fulldisclosure/2012/May/238
[2] http://sqlcipher.net/

Wednesday, August 15, 2012

Uniform Binary Search Implementation in JavaScript

Uniform binary search is an optimization of the classic binary search algorithm invented by Donald Knuth and given in Knuth's The Art of Computer Programming. It uses a lookup table to update a single array index, rather than taking the midpoint of an upper and a lower bound on each iteration; therefore, it is optimized for architectures (such as Knuth's MIX) on which
  • a table lookup is generally faster than an addition and a shift, and 
  • many searches will be performed on the same array, or on several arrays of the same length

Just simply implemented in JS from original C source of Knuth's algorithm.


// target = [91, 97, 99, 101, 127, 129, 145]
// will found index of 127 via optimized bin search algo.

thinking...
-----------------
middle of target: 3
127 is bigger than 101
127 is less than 129
127 at index: 4

Source: http://jsfiddle.net/VCtqD/1/

Monday, July 9, 2012

IE Col Element Heap Overflow Vulnerability (CVE-2012-1876) PoC

IE Col Element Heap Overflow Vulnerability (CVE-2012-1876) PoC 
write up soon..
UPDATE: VUPEN (author of this vulnerability) released detailed blog post about this vulnerability.

Tuesday, June 5, 2012

Friday, February 24, 2012

Java Web Start Cmd Arg Injection

ZDI(ZDI-12-039)[1] tarafından bildirilen ve Oracle Şubat CPU ile Java Web Start'ı etkileyen bir zafiyet yamalandı. Zafiyet kısaca daha önce bir benzerini[2] gördüğümüz türden komut satırı argumanlarina mudahele edebiliyoruz. İlgili zafiyetin PoC kodunu yazmak icin ilk olarak JRE 1.6 u30 versiyonunu sisteme kurdum. javaws.exe'nin bir yedegini aldim ve JRE'yi guncelledim. javaws.exe versiyonu 6.0.300.12, guncellenmis versiyon ise 6.0.310.5. Hemen bir patch diff islemi uyguladim. Patch diff islemi icin onceden PatchDiff2 ve Turbodiff gibi yazilimlardan yararlaniyordum fakat DarunGrim3'e bir sans verdim, inanilmaz derecede sureci kolaylastirmis ve hizlandirmis, kullanmak isteyenlere tavsiye ederim. Ayrıca gozu bozmayan, "hacker dostu" bir web arayuzude var :> www.darungrim.org adresinden indirebilirsiniz. Neyse analize gecelim..

Thursday, February 16, 2012

MS11-100 - ASP.NET Forms Auth. Bypass - Revenge of the 0x00

Microsoft MS11-100 güncellemesi ile geçen ay sonlarına doğru meşhur HashTable Collision DoS (CVE-2011-3414), .NET Forms Authentication Bypass (CVE-2011-3416) v.b. .NET platformunu etkileyen güvenlik açıklarını kapattı. Bu blog girdisinde ele alacağım zafiyet ise .NET Forms Authentication Bypass (Revenge of the NULL Byte).

Friday, February 3, 2012

Is ForeFront Bypassable?

Is Microsoft's ForeFront bypassable? Maybe yes (not confirmed yet). During a penetration test of one of our clients (on my past job), ForeFront don't allow us to get meterpreter session (expected result lol), when meterpreter copied to disc, ForeFront denied (possible detect it as malicious) outgoing connections of meterpreter. But in another case, we inspect that when you execute your meterpreter executable over Network Share folder, you are bypassing(high possibility, i am not sure it's a feature or not) ForeFront and ForeFront will not check your executable.

Firstly we got an RDP session (we found local administrator password but we need mpreter for some local priv. escalations etc..), mount our local disk to target machine, run meterpreter executable from network share and BINGO! we have a session!

sudo format string vulnerability

This summary is not available. Please click here to view the post.

Wednesday, July 27, 2011

Return-Oriented Programming / DEP Bypass

Giriş
Öncelikle şunu belirtmekte fayda var bu makale Türkiye güvenlik & hacking topluluğuna destek amaçlı teknik konularda bilgi ve beceri kazandırabilme adına yazılmıştır. Makalede eksik ya da yanlış gördüğünüz kısımları lütfen yorum olarak/e-mail ile bana ulaştırınız gerekli düzenlemeleri hep birlikte yapalım. Ayrıca şunuda belirtmek lazım şuan için bu makalede sadece Windows üzerinde DEP korumasının ROP tekniği ile aşılması ele alınmıştır, başka işletim sistemleri içinde ilerleyen süreçte yazabilirim -vakit olursa- umarım.

"Neden ROP tekniğine ihtiyaç duyuyoruz?" sorusuna cevap olarak DEP diyebiliriz. DEP, Windows sistemlerde Stack'in NX (No eXecute) yani üzerinde kod çalıştırılamaz hale getirilmesini sağlayan bir korunma yöntemidir (Açılımı "Data Execution Prevention"). ROP ise Windows'un DEP korumasını aşmak ve NX Stack üzerinde kod çalıştırabilmek için kullanılan bir tekniktir.

Daha önce exploiting ile uğraşmış olanlar bilirler, ret2lib tekniğini. ROP tekniğide işte tam bu tekniğin yaptığını peşpeşe birçok adrese "return" olarak yapıyor ve bir şekilde stack'i üzerinde kod çalıştırılabilir hale getiriyor ya da Memory'de RWX bir alana Shellcode'unuzu yazmanızı ve çalıştırmanızı sağlıyor (DEP Bypass için birçok yöntem mevcut..). Yani genel amaç mevcut olan kodları register'lardaki değerleri değiştirmek, kullanacağınız API'nin parametrelerini ayarlamak v.b için tekrar kullanmaktır. Mevcut olan kodlardan kastımız ise gadget'lar olarak geçen kod parçaları. Tanım kolay gözüksede birazdan makalenin uygulama kısmında mevcut kodlar ile kod yazmanın zorluklarını çekeceğiz o yüzden rahatlamayın :)

Monday, July 18, 2011

ELF File Format Parsing

In this post i will explain how to parse 32 bit ELF File Format for finding offsets of segments. Firstly we need to lookup ELF Header (First 52 bytes) for taking offsets of Program Headers Table, EntryPoint Addr, Section Headers Tables etc..

If we take an DWORD value from 24th offset of ELF Header we can grab EntryPoint of executable file. DWORD value at 32th offset is start offset of Section Headers Table and size of this headers table is located at 46th offset as a WORD value. We also need number of section headers that located at 48th offset as a WORD value. Also Section Header String Table Index is located at 50th offset as a WORD value. So we can say ELF Header structure is like this;

Wednesday, June 29, 2011

[Etkinlik] Web Tehditlerine Karsı Hazırlıklı Olun



28 Haziran 2011 tarihinde HP Yazılım – İnovasyon Merkezi’nde gerçekleşmiş olan “Web Tehditlerine Karşı Hazırlıklı Olun” isimli seminere ait sunum ve fotoğraflar aşağıdadır. Katılan herkese teşekkürler umarım faydalı geçmiştir :)

Sunum Dosyası (PDF):
http://www.adeosecurity.com/sunum/HP-AppSec-Presentation.pdf

Fotoğraflar :
http://www.adeosecurity.com/sunum/hp-sunum-resimler.zip

(Yedek) Sunum Dosyası (PDF):
https://rapidshare.com/files/2951370146/HP-AppSec-Presentation.pdf

Thursday, June 16, 2011

[gdb tips] printing SSE2 registers

Hi!
I started [gdb tips] title for sharing useful gdb tips & tricks. First tip is printing SSE2 registers. You can use print/x for accessing SSE2 registers context.

Example;

Neden normal arkadaslarim yok :>

Bende normal arkadaşlar istiyorum!!!1 Ali en normallerinden birisi :p

for english reader; My friend Ali's Wireless Bazooka

Wednesday, June 15, 2011

IstSec '11 Sunumları

Selamlar,
Biraz geç oldu ama sonunda sunumları blog'a girme zahmetinde bulundum :> IstSec 11 güzel geçti (en azından bizim oturum). Son dakika değişiklikleri olmuş bizim salon değişmiş vs.. haberimiz yoktu süpriz oldu bizede :] Yasin SÜRER ile güzel bir deneyim oldu. Konumuz Yeni Nesil Zararlı Kodlardı. Java tabanlı dropper'lardan, Sosyal ağları hedef alan JavaScript worm'lerinden ve geleneksel binary tabanlı zararlı kodların analizinden bahsettik, salonun doluluk oranı tatmin etti bizi, en azından bizi mutlu eden bu tip spesifik konulara bile olan ilgiydi. Daha güzel projelerle yine sahnelerde not alabiliriz bunuda bir spoiler olarak bildireyim buradan. Beklemede kalın ;)

Canberk BOLAT ve Yasin SÜRER - New Generation Malwares & Analysis sunumunu indirmek için tıklayın.

Sunday, May 22, 2011

IstSec '11

Selamlar,
IstSec '11 3-4 Haziran 2011 tarihlerinde Istanbul Bilgi Universitesi Dolapdere kampüsünde olacak. Bizde çalışma arkadaşım (aynı zamanda kardeşim diyebildiğim insanlardan birisi..) Yasin ile Yeni Nesil Zararlı Kodlar ve Analizi adında bir sunum yapacağız, bittiğinde sunumun PDF versiyonunuda buradan yayınlayacağım.

Ayrıca ADEO Security Labs çatısı altında bizleri toplayan ve Türkiye'de ki tabulaşmış güvenlik anlayışının dışında çalışmalarımızı destekleyen sevgili Halil Abi'de Advanced Windows Registry Forensics adında bir sunum yapacak.

Oraya gelecek arkadaşlarla görüşmek üzere ;)

Thursday, May 12, 2011

PE Browser

İlgili dökümanda* bahsettiğimiz PE-Browser sadece o anlık bir çözümdü, biraz daha geliştirip konsol gibi bir çözüm düşünüyoruz, yakinda başlarım onada :>


[*] http://www.adeosecurity.com/guvenlik/dump-exe-with-c-ruby/