{"id":1855,"date":"2022-10-12T10:15:14","date_gmt":"2022-10-12T08:15:14","guid":{"rendered":"https:\/\/security.humanativaspa.it\/?p=1855"},"modified":"2025-09-15T13:38:05","modified_gmt":"2025-09-15T13:38:05","slug":"semgrep-rules-for-kotlin-security-assessment","status":"publish","type":"post","link":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/","title":{"rendered":"Semgrep rules for Kotlin security assessment"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I recently had the chance to assess the security of many applications with a <strong>back-end<\/strong> written in the <a href=\"https:\/\/kotlinlang.org\/\">Kotlin<\/a> language. Unfortunately, at the moment <a href=\"https:\/\/semgrep.dev\/\">Semgrep<\/a>&#8216;s support for the Kotlin is still in &#8220;Beta&#8221; and there are not many public rules for this language. So, I decided to write a bunch of them on my own, mainly to look for potential <strong>SQL Injections<\/strong>. These rules were written with limited time, they are non-exhaustive, and can definitely be optimized. However, they are field-tested and have proven to do their job quite well.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-1871\" src=\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2022\/10\/semgrep-1.png\" alt=\"\" width=\"1177\" height=\"829\" srcset=\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2022\/10\/semgrep-1.png 1177w, https:\/\/hnsecurity.it\/wp-content\/uploads\/2022\/10\/semgrep-1-300x211.png 300w, https:\/\/hnsecurity.it\/wp-content\/uploads\/2022\/10\/semgrep-1-1024x721.png 1024w, https:\/\/hnsecurity.it\/wp-content\/uploads\/2022\/10\/semgrep-1-768x541.png 768w, https:\/\/hnsecurity.it\/wp-content\/uploads\/2022\/10\/semgrep-1-350x247.png 350w\" sizes=\"(max-width: 1177px) 100vw, 1177px\" \/><\/p>\n<p>Meanwhile, I also wrote a couple of rules related to <strong>Android mobile application&#8217;s client<\/strong> code, to quickly identify WebView functionalities in order to inspect their security configurations (for more info, see <a href=\"https:\/\/github.com\/OWASP\/owasp-mstg\/blob\/master\/Document\/0x05h-Testing-Platform-Interaction.md\">Android Platform APIs page of OWASP Mobile Testing Guide<\/a>), both for Java and Kotlin.<\/p>\n<p>These rules can be found in my Semgrep rules repository on GitHub: <a href=\"https:\/\/github.com\/federicodotta\/semgrep-rules\">https:\/\/github.com\/federicodotta\/semgrep-rules<\/a><\/p>\n<p>If you&#8217;re interested in Semgrep and static analysis, you should also check out our Semgrep <a href=\"https:\/\/hnsecurity.it\/semgrep-ruleset-for-c-c-vulnerability-research\/\">C\/C++<\/a> and <a href=\"https:\/\/hnsecurity.it\/semgrep-rules-for-php-security-assessment\/\">PHP<\/a> rulesets for vulnerability research.<\/p>\n<p>Cheers!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, I recently had the chance to assess the security of many applications with a back-end written in the Kotlin [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":159955,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[88],"tags":[82,85,105,162,168,169],"class_list":["post-1855","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tools","tag-vulnerability-research","tag-mobile","tag-java","tag-semgrep","tag-kotlin","tag-whitebox"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HN Security Semgrep rules for Kotlin security assessment<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HN Security Semgrep rules for Kotlin security assessment\" \/>\n<meta property=\"og:description\" content=\"Hi, I recently had the chance to assess the security of many applications with a back-end written in the Kotlin [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/\" \/>\n<meta property=\"og:site_name\" content=\"HN Security\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-12T08:15:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-15T13:38:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"836\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Federico Dotta\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hnsec\" \/>\n<meta name=\"twitter:site\" content=\"@hnsec\" \/>\n<meta name=\"twitter:label1\" content=\"Scritto da\" \/>\n\t<meta name=\"twitter:data1\" content=\"Federico Dotta\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo di lettura stimato\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/\"},\"author\":{\"name\":\"Federico Dotta\",\"@id\":\"https:\/\/hnsecurity.it\/it\/#\/schema\/person\/e0e6046bd2bc829f7d945ad361bce702\"},\"headline\":\"Semgrep rules for Kotlin security assessment\",\"datePublished\":\"2022-10-12T08:15:14+00:00\",\"dateModified\":\"2025-09-15T13:38:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/\"},\"wordCount\":186,\"publisher\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/#organization\"},\"image\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg\",\"keywords\":[\"vulnerability research\",\"mobile\",\"Java\",\"semgrep\",\"kotlin\",\"whitebox\"],\"articleSection\":[\"Tools\"],\"inLanguage\":\"it-IT\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/\",\"url\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/\",\"name\":\"HN Security Semgrep rules for Kotlin security assessment\",\"isPartOf\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg\",\"datePublished\":\"2022-10-12T08:15:14+00:00\",\"dateModified\":\"2025-09-15T13:38:05+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage\",\"url\":\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg\",\"contentUrl\":\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg\",\"width\":1600,\"height\":836,\"caption\":\"Semgrep logo\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hnsecurity.it\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Semgrep rules for Kotlin security assessment\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hnsecurity.it\/it\/#website\",\"url\":\"https:\/\/hnsecurity.it\/it\/\",\"name\":\"HN Security\",\"description\":\"Offensive Security Specialists\",\"publisher\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hnsecurity.it\/it\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/hnsecurity.it\/it\/#organization\",\"name\":\"HN Security\",\"url\":\"https:\/\/hnsecurity.it\/it\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/hnsecurity.it\/it\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2026\/01\/hn-libellula.jpg\",\"contentUrl\":\"https:\/\/hnsecurity.it\/wp-content\/uploads\/2026\/01\/hn-libellula.jpg\",\"width\":696,\"height\":696,\"caption\":\"HN Security\"},\"image\":{\"@id\":\"https:\/\/hnsecurity.it\/it\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/hnsec\",\"https:\/\/www.linkedin.com\/company\/hnsecurity\/\",\"https:\/\/github.com\/hnsecurity\",\"https:\/\/infosec.exchange\/@hnsec\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/hnsecurity.it\/it\/#\/schema\/person\/e0e6046bd2bc829f7d945ad361bce702\",\"name\":\"Federico Dotta\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/02d5d800b81f2a125ac23ee31a108ee2404d123bd3b722f2e263f0130cc1df42?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/02d5d800b81f2a125ac23ee31a108ee2404d123bd3b722f2e263f0130cc1df42?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/02d5d800b81f2a125ac23ee31a108ee2404d123bd3b722f2e263f0130cc1df42?s=96&d=mm&r=g\",\"caption\":\"Federico Dotta\"},\"url\":\"https:\/\/hnsecurity.it\/it\/blog\/author\/federico-dotta\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HN Security Semgrep rules for Kotlin security assessment","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/","og_locale":"it_IT","og_type":"article","og_title":"HN Security Semgrep rules for Kotlin security assessment","og_description":"Hi, I recently had the chance to assess the security of many applications with a back-end written in the Kotlin [&hellip;]","og_url":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/","og_site_name":"HN Security","article_published_time":"2022-10-12T08:15:14+00:00","article_modified_time":"2025-09-15T13:38:05+00:00","og_image":[{"width":1600,"height":836,"url":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg","type":"image\/jpeg"}],"author":"Federico Dotta","twitter_card":"summary_large_image","twitter_creator":"@hnsec","twitter_site":"@hnsec","twitter_misc":{"Scritto da":"Federico Dotta","Tempo di lettura stimato":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#article","isPartOf":{"@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/"},"author":{"name":"Federico Dotta","@id":"https:\/\/hnsecurity.it\/it\/#\/schema\/person\/e0e6046bd2bc829f7d945ad361bce702"},"headline":"Semgrep rules for Kotlin security assessment","datePublished":"2022-10-12T08:15:14+00:00","dateModified":"2025-09-15T13:38:05+00:00","mainEntityOfPage":{"@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/"},"wordCount":186,"publisher":{"@id":"https:\/\/hnsecurity.it\/it\/#organization"},"image":{"@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage"},"thumbnailUrl":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg","keywords":["vulnerability research","mobile","Java","semgrep","kotlin","whitebox"],"articleSection":["Tools"],"inLanguage":"it-IT"},{"@type":"WebPage","@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/","url":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/","name":"HN Security Semgrep rules for Kotlin security assessment","isPartOf":{"@id":"https:\/\/hnsecurity.it\/it\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage"},"image":{"@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage"},"thumbnailUrl":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg","datePublished":"2022-10-12T08:15:14+00:00","dateModified":"2025-09-15T13:38:05+00:00","breadcrumb":{"@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/"]}]},{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#primaryimage","url":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg","contentUrl":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg","width":1600,"height":836,"caption":"Semgrep logo"},{"@type":"BreadcrumbList","@id":"https:\/\/hnsecurity.it\/it\/blog\/semgrep-rules-for-kotlin-security-assessment\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hnsecurity.it\/it\/"},{"@type":"ListItem","position":2,"name":"Semgrep rules for Kotlin security assessment"}]},{"@type":"WebSite","@id":"https:\/\/hnsecurity.it\/it\/#website","url":"https:\/\/hnsecurity.it\/it\/","name":"HN Security","description":"Offensive Security Specialists","publisher":{"@id":"https:\/\/hnsecurity.it\/it\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hnsecurity.it\/it\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":"Organization","@id":"https:\/\/hnsecurity.it\/it\/#organization","name":"HN Security","url":"https:\/\/hnsecurity.it\/it\/","logo":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/hnsecurity.it\/it\/#\/schema\/logo\/image\/","url":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2026\/01\/hn-libellula.jpg","contentUrl":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2026\/01\/hn-libellula.jpg","width":696,"height":696,"caption":"HN Security"},"image":{"@id":"https:\/\/hnsecurity.it\/it\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/hnsec","https:\/\/www.linkedin.com\/company\/hnsecurity\/","https:\/\/github.com\/hnsecurity","https:\/\/infosec.exchange\/@hnsec"]},{"@type":"Person","@id":"https:\/\/hnsecurity.it\/it\/#\/schema\/person\/e0e6046bd2bc829f7d945ad361bce702","name":"Federico Dotta","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/secure.gravatar.com\/avatar\/02d5d800b81f2a125ac23ee31a108ee2404d123bd3b722f2e263f0130cc1df42?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/02d5d800b81f2a125ac23ee31a108ee2404d123bd3b722f2e263f0130cc1df42?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/02d5d800b81f2a125ac23ee31a108ee2404d123bd3b722f2e263f0130cc1df42?s=96&d=mm&r=g","caption":"Federico Dotta"},"url":"https:\/\/hnsecurity.it\/it\/blog\/author\/federico-dotta\/"}]}},"jetpack_featured_media_url":"https:\/\/hnsecurity.it\/wp-content\/uploads\/2025\/09\/SEMGREP.jpg","_links":{"self":[{"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/posts\/1855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/comments?post=1855"}],"version-history":[{"count":1,"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/posts\/1855\/revisions"}],"predecessor-version":[{"id":160153,"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/posts\/1855\/revisions\/160153"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/media\/159955"}],"wp:attachment":[{"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/media?parent=1855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/categories?post=1855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hnsecurity.it\/it\/wp-json\/wp\/v2\/tags?post=1855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}