<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Parit Wattanasin on Medium]]></title>
        <description><![CDATA[Stories by Parit Wattanasin on Medium]]></description>
        <link>https://medium.com/@paritwattanasin?source=rss-2cbf7b022346------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*zMusbE0K9_EXXgdN.</url>
            <title>Stories by Parit Wattanasin on Medium</title>
            <link>https://medium.com/@paritwattanasin?source=rss-2cbf7b022346------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 17:58:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paritwattanasin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[OWASP API 2019 : API-2 Broken User Authentication]]></title>
            <link>https://medium.com/blog-blog/owasp-api-2019-api-2-broken-user-authentication-d7c5c790b8fc?source=rss-2cbf7b022346------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7c5c790b8fc</guid>
            <category><![CDATA[owasp-api]]></category>
            <dc:creator><![CDATA[Parit Wattanasin]]></dc:creator>
            <pubDate>Thu, 07 Jan 2021 03:55:09 GMT</pubDate>
            <atom:updated>2021-01-07T03:55:09.179Z</atom:updated>
            <content:encoded><![CDATA[<h3>OWASP API 2019 : API-2 Broken User Authentication</h3><p>ความปลอดภัยในการสร้าง API ที่ควรรู้ ซึ่งเป็นเรื่องที่ 2 ใน series ชุด OWASP API 2019 ว่าด้วยเรื่อง Broken User Authentication นะครับ สำหรับผู้อ่านที่ยังไม่ทราบว่า OWASP คือใคร สามารถค้นหาได้จาก google เลยครับมีเพียบ แต่ถ้าอยากอ่านจากต้นฉบับไปที่นี่เลย <a href="https://owasp.org/projects/">Projects | OWASP</a> มีรายละเอียดเยอะมาก</p><p>เริ่มกันเลยดีกว่า</p><p>ตามนิยามต้นฉบับ</p><blockquote><strong>API2:2019 Broken User Authentication</strong></blockquote><blockquote>Authentication mechanisms are often implemented incorrectly, allowing attackers to compromise authentication tokens or to exploit implementation flaws to assume other user’s identities temporarily or permanently. Compromising a system’s ability to identify the client/user, compromises API security overall.</blockquote><p>แปลกันด้วย google translate</p><blockquote>กลไกการพิสูจน์ตัวตนมักจะถูกนำไปใช้อย่างไม่ถูกต้องทำให้ผู้โจมตีสามารถประนีประนอมโทเค็นการตรวจสอบสิทธิ์หรือใช้ประโยชน์จากข้อบกพร่องในการนำไปใช้เพื่อถือว่าตัวตนของผู้ใช้คนอื่นเป็นแบบชั่วคราวหรือถาวร การประนีประนอมความสามารถของระบบในการระบุไคลเอนต์ / ผู้ใช้ทำให้ความปลอดภัยของ API ลดลง</blockquote><p>อ่านดูก็พอจะเข้าใจนะ แต่มาตีความโดยความเข้าใจกันดีกว่า</p><p>เรื่องการทำ Authentication ที่มักจะเอาไป implement กับแบบผิดๆ หรือไม่ถูกวิธี จะทำให้ attacker หรือผู้ไม่หวังดี/ผู้บุกรุก สามารถยึด authentication token มาใช้ประโยชน์จากช่องโหว่เสมือนกับ ผู้ใช้งานเข้ามาเอง โดยระบบที่ถูกโจมตีในรูปแบบนี้ จะทำให้ความปลอดภัยของ API ในภาพรวมของระบบลดลงในทันที</p><p>ในภาพรวมนิยามจะคล้าย ๆ กับ <a href="https://owasp.org/www-project-top-ten/2017/A2_2017-Broken_Authentication">A2:2017-Broken Authentication </a>ใน Top 10 Web Application Security Risks ซึ่งสามารถอ่านเพิ่มเติมได้ที่ <a href="https://medium.com/blog-blog/broken-authentication-b476750a6d8b">Broken Authentication. | by Oraphanthong T. | blog blog</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*3gviug3Su9izBl7aGtYwwQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*NLyRmPy6oVrHLlM8FSRqZA.png" /></figure><p>แบบไหนละที่เรียกว่าเสี่ยง</p><ul><li>ระบบไม่มีการดักให้ไม่สามารถสร้าง/แจ้งเตือน พวก <a href="https://droidsans.com/25-top-worst-passwords-list/">user หรือ password ยอดนิยม</a> หรือ default user/password เพราะ attacker อาจจะใช้ user / password เหล่านี้มาลองเข้าระบบ</li><li>api ยอมให้ attacker ทำ brute force บน user ซ้ำๆ โดยไม่มี captcha</li><li>ยอมให้มีการสร้าง weak password ซึ่งตรงข้ามกับ <a href="https://medium.com/@mohammedijas/the-art-of-creating-a-strong-password-61d4c2feb14f">strong password</a></li><li>มีการส่งข้อมูล sensitive เช่น auth tokens และ password ใน url</li><li>ไม่มีการตรวจสอบ token</li><li>ยอมให้มีการใช้งาน weak signed JWT token โดยอาจจะรวมไปถึง expire date</li><li>ใช้ plain text, non-encrypt, weakly hashed password</li><li>ใช้ weak encryption keys</li></ul><p>แนวทางป้องกัน</p><ul><li>ต้องเข้าใจเกี่ยวกับเรื่องการทำ authentication เพื่อจะได้รู้ว่าจะจัดการอย่างไร</li><li>Don’t reinvent the wheel in authentication, token generation, password storage. Use the standard. (ข้อนี้ขอยกภาษาอังกฤษมาทั้งหมด เนื่องจากมีน้องใน office คนนึงชอบพูดข้อความประมาณนี้)</li><li>ให้ศึกษา <a href="https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html">OWASP Authentication Cheatsheet</a></li><li>ถ้าเป็นไปได้ให้ใช้ multi-factor authentication (ใช้หลายๆ เครื่องมือในการยืนยันตัวตน)</li><li>หาทาง<a href="https://owasp.org/www-community/controls/Blocking_Brute_Force_Attacks"> implement anti brute force </a>อ่านรายละเอียดเพิ่มเติม</li></ul><p>ส่งท้าย</p><p>OWASP API 2019 ถือเป็นโครงการในระดับ Lab Project ซึ่งในนิยามคือ โครงการที่ OWASP ได้ตรวจสอบแล้วใช้งานได้แต่ยังไม่ถึงขั้น Flagship เหมือน <a href="https://owasp.org/www-project-top-ten/">OWASP Top Ten Web Application Security Risks</a> ในความหมายคือ เป็น Project ที่นิ่งระดับหนึ่งแต่ยังมีโอกาสให้มีการพัฒนาในแง่ของเอกสาร หรือตัวอย่างมากขึ้นในอนาคต เพื่อให้ได้รับคัดเลือกเป็น <a href="https://owasp.org/www-pdf-archive/PROJECT_LEADER-HANDBOOK_2014.pdf">Flagship</a></p><p>ซึ่งทาง OWASP ได้จัดระดับของโครงการไว้ 3 แบบคือ <strong>Flagship Projects, Lab Projects และ Incubator Projects</strong></p><p>หวังว่าอนาคตเราจะได้มาศึกษา Project อื่นๆ ของ OWASP กันอีกนะครับ ไม่ว่าจะเป็น <a href="https://owasp.org/www-project-mobile-top-10/">OWASP Mobile Top 10</a> <a href="https://owasp.org/www-project-docker-top-10/">OWASP Docker Top 10</a> กดติดตามกันไว้</p><p>reference:</p><p><a href="https://owasp.org/www-project-api-security/">OWASP API Security — Top 10 | OWASP</a></p><p><a href="https://github.com/OWASP/API-Security/raw/master/2019/en/dist/owasp-api-security-top-10.pdf">https://github.com/OWASP/API-Security/raw/master/2019/en/dist/owasp-api-security-top-10.pdf</a></p><p><a href="https://droidsans.com/25-top-worst-passwords-list/">รวม 25 อันดับ Password ยอดแย่ที่สุดประจำปี 2019 เผยรหัส 123456 ครองแชมป์ 7 ปีซ้อน | DroidSans</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7c5c790b8fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blog-blog/owasp-api-2019-api-2-broken-user-authentication-d7c5c790b8fc">OWASP API 2019 : API-2 Broken User Authentication</a> was originally published in <a href="https://medium.com/blog-blog">blog blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A3-Sensitive Data Exposure]]></title>
            <link>https://medium.com/blog-blog/a3-sensitive-data-exposure-869414f11747?source=rss-2cbf7b022346------2</link>
            <guid isPermaLink="false">https://medium.com/p/869414f11747</guid>
            <category><![CDATA[owasp-top-10]]></category>
            <category><![CDATA[owasp]]></category>
            <dc:creator><![CDATA[Parit Wattanasin]]></dc:creator>
            <pubDate>Wed, 13 Mar 2019 03:50:10 GMT</pubDate>
            <atom:updated>2019-03-13T03:50:10.083Z</atom:updated>
            <content:encoded><![CDATA[<h3>หัวข้อที่กำลังมาแรงในโลกยุคที่ data privacy มีความสำคัญอย่างมาก</h3><p>แล้วเราก็มาถึงหัวข้อ OWASP Top10–2017 A3 Sensitive Data Exposure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*y_9TEROrAWltEppAW2AVhA.jpeg" /><figcaption><a href="https://depositphotos.com/125305248/stock-photo-sensitive-data-word-cloud.html">https://depositphotos.com/125305248/stock-photo-sensitive-data-word-cloud.html</a></figcaption></figure><p><strong>คืออะไร:</strong></p><p>เรื่อง Sensitive Data Exposure เป็นหัวข้อมาตั้งแต่ OWASP Top10 2013 2013-A6: Sensitive Data Exposure แต่ถ้าจะให้ลึกไปกว่านั้น จริงๆ มันเกิดมาตั้งแต่ <a href="https://www.owasp.org/index.php/Top_10_2013-Release_Notes">OWASP Top10 2010 เกิดจากการรวมกันของ 2010-A7 — Insecure Cryptographic Storage &amp; 2010-A9 — Insufficient Transport Layer Protection</a> แสดงว่ามันต้องมีความสำคัญจริงๆ</p><p>ว่าแต่มันคือะไรเหรอตามคำนิยามที่เค้าว่าไว้</p><blockquote>Many web applications and APIs do not properly protect sensitive data, such as financial, healthcare, and PII. Attackers may steal or modify such weakly protected data to conduct credit card fraud, identity theft, or other crimes. Sensitive data may be compromised without extra protection, such as encryption at rest or in transit, and requires special precautions when exchanged with the browser.</blockquote><p>แปลได้ความว่า Web หรือ API ที่ไม่ได้มีการป้องกัน หรือป้องกันได้ไม่ดีพอ เกี่ยวกับข้อมูลที่มีความสำคัญ เช่นข้อมูลทางด้านการเงิน สุขภาพ รวมถึง PII(ศัพท์ใหม่ ไม่เคยได้ยิน 55 คร่าวๆ คือข้อมูลที่ใช้ระบุตัวบุคคลได้ เดี๋ยวไว้ด้านล่างค่อยมาดูว่ามันคืออะไร ) ซึ่งอาจส่งผลให้ผู้ไม่หวังดี(Attacker) อาจจะขโมยหรือแก้ไขข้อมูล เพื่อกระทำการบางอย่างที่ไม่ดีต่อไป</p><p>แล้วอะไรบ้างที่ถือว่าเสี่ยง คงต้องมานิยามใน Application ของเราก่อนว่าอะไรบ้างที่ถือว่าเป็น Sensitive Data เช่น password หมายเลขบัตรเครดิต จริงๆ แล้วพวกหมายเลขบัตรประชาชน นี่ก็ถือเป็น sensitive data ด้วยนะ เพราะในหลายๆ ระบบอาจจะมีการใช้หมายเลขบัตรในการยืนยันตัวตน โดยอาจจะรวมถึงข้อมูลอื่นๆ ที่อยู่ในนิยามทางด้านกฎหมาย เช่น GDPR หรือกฎอื่นๆ แล้วแต่เรื่อง(หมายความว่าอาจจะต้องมานิยามตามแต่บริบทของการใช้งานในโปรแกรมนั้น)</p><p>ในการส่งข้อมูล — ระหว่างที่เก็บกับปลายทาง ข้อมูลเหล่านั้นมีการเข้ารหัสไว้หรือไม่ ไม่ควรส่งเป็นข้อความที่มองแล้วดูรู้เลย protocol ที่ใช้ เหมาะสมมั๊ย https, sftp, ..<br>การเก็บข้อมูล — ก่อนเก็บมีการเข้ารหัสหรือไม่<br>algorithm — เราใช้ algorithm ที่เข้ารหัสแบบที่มีความ strong พอหรือไม่ ** อาจจะต้องตั้งเป็นรอบของการ review เอาไว้ เพราะพวก algorithm ที่เคยใช้ได้ หรือยอมรับในอดีต ไม่ได้หมายความว่าปัจจุบันจะใช้ได้เสมอไป ด้วยเทคโนโลยีหรือ hardware ที่เปลี่ยนไป ทำให้การถอดรหัสทำได้ง่ายขึ้น<br>รวมถึง user agent ต่างๆที่ใช้ มีการเช็ค server certificate มั๊ยว่ายัง valid อยู่</p><p><strong>แนวทางการป้องกัน</strong><br>1 classify<br>2 กำหนด control ตามการแยกกลุ่มประเภท<br>3 ถ้าไม่จำเป็นไม่ควรเก็บ sensitive data หรือใช้เสร็จให้รีบเคลียร์<br>4 อย่าลืม encrypt data<br>5 up-to-date strong standard algorithm รวมถึง protocol และใช้ key management ที่เหมาะสม<br>6 การส่งข้อมูลควรส่งผ่าน protocol ที่ secure เช่น TLS =&gt; มีหลาย version และมีประวัติศาสตร์ รวมถึงการใช้ HSTS<br>7 disable cache กรณีที่ response มีข้อมูลพวก sensitive<br>8 password ควรใช้ strong adaptive และ salted hashing function with a work factor เช่น Argon2, scrypt, bcrypt หรือ PBKDF2</p><blockquote>ทุกวันนี้คุณเก็บ password แบบ one-way ด้วย hashing function แล้วหรือยังงงงง</blockquote><p>Part หน้าเรามาลงลึกทางด้าน Technical กันบ้าง</p><p>ก่อนจากกัน เรามาย้ำกันอีกครั้งว่า <strong><em>เรื่อง Security เป็นเรื่องของทุกคน</em></strong> เราจะต้องให้ความสนใจกับเรื่องนี้ให้มากๆ โดยเฉพาะ Developer ที่เป็นต้นทางของการสร้าง software โดยหวังว่า series ชุด OWASP Top10 2017 จะเป็นจุดเริ่มต้นของการตระหนักด้าน software security ให้กับผู้อ่าน</p><p>ทิ้งท้าย หาข้อมูลเพิ่มเติมได้ที่ไหน ที่นี่เลย <a href="https://www.owasp.org/">https://www.owasp.org</a> ข้อมูลหลักที่รวบรวมข้อมูลด้าน security ไว้ มีคลังมากมายสามารถเข้าไปค้นคว้าได้</p><p>PII =&gt; Personally Identifiable Information จากความหมายใน wiki คือ ข้อมูลที่สามารถใช้ระบุตัว ติดต่อหรือค้นหาบุคคลหนึ่งบุคคลใดโดยเฉพาะ หรือเป็นข้อมูลที่ใช้ร่วมกับข้อมูลอื่นเพื่อระบุตัวบุคคลหนึ่งบุคคลใด สนใจสามารถค้นคว้าต่อได้ที่ <a href="https://th.wikipedia.org/wiki/%E0%B8%82%E0%B9%89%E0%B8%AD%E0%B8%A1%E0%B8%B9%E0%B8%A5%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%A3%E0%B8%B0%E0%B8%9A%E0%B8%B8%E0%B8%95%E0%B8%B1%E0%B8%A7%E0%B8%9A%E0%B8%B8%E0%B8%84%E0%B8%84%E0%B8%A5%E0%B9%84%E0%B8%94%E0%B9%89">https://th.wikipedia.org/wiki/ข้อมูลที่ระบุตัวบุคคลได้</a> ในนั้นจะบอกถึงว่าข้อมูลอะไรบ้างที่ถือว่าเป็น PII แต่อาจจะเป็นแค่ตัวอย่างของอเมริกา แต่ก็คือว่าใช้เป็นหลักได้</p><p>ref:</p><ul><li><a href="https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project#OWASP_Top_10_for_2010">Category:OWASP Top Ten Project - OWASP</a></li><li><a href="https://www.owasp.org/index.php/Top_10_2013-Release_Notes">Top 10 2013-Release Notes - OWASP</a></li><li><a href="https://www.patanasongsivilai.com/blog/password-hash-function-salt-values/">เข้ารหัส Password ด้วย Hash function กับ Salt values</a></li><li><a href="https://www.blognone.com/node/43630">Hash: ไม่รู้ว่ามันคืออะไรแต่มันใช่</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=869414f11747" width="1" height="1" alt=""><hr><p><a href="https://medium.com/blog-blog/a3-sensitive-data-exposure-869414f11747">A3-Sensitive Data Exposure</a> was originally published in <a href="https://medium.com/blog-blog">blog blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>