{"id":99419,"date":"2024-12-08T10:24:32","date_gmt":"2024-12-08T08:24:32","guid":{"rendered":"https:\/\/staging.checkmarx.com\/?p=99419"},"modified":"2025-01-03T10:36:08","modified_gmt":"2025-01-03T08:36:08","slug":"malicious-npm-package-exploits-react-native-documentation-example","status":"publish","type":"zero-post","link":"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/","title":{"rendered":"Malicious NPM Package Exploits React Native Documentation Example"},"content":{"rendered":"<p>A recent discovery revealed how official documentation can become an unexpected attack vector for supply chain attacks. It happened when an npm package called &#8220;rtn-centered-text&#8221; exploited an example from React Native&#8217;s Fabric Native Components guide in an attempt to trick developers into downloading their package, putting systems at risk.<\/p>\n\n\n\n<h2 class=\"wp-block-heading article-anchor\" id=\"article-anchor-1\">Key Findings<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>An attacker published a malicious package that mirrors an example from React Native&#8217;s official documentation, in an attempt to trick developers following the official guide.<\/li>\n\n\n\n<li>By leveraging a subtle imprecision in package management instructions, the attack demonstrates how documentation can inadvertently become an attack vector<\/li>\n\n\n\n<li>This incident highlights the importance of the principle &#8220;trust but verify&#8221;.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading article-anchor\" id=\"article-anchor-2\">The Attack Vector: Documentation as an Entry Point<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"800\" src=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/react-github-repo-1024x800.png\" alt=\"official react native new architecture repo with 1.5k stars\" class=\"wp-image-99420\" srcset=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/react-github-repo-1024x800.png 1024w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/react-github-repo-300x234.png 300w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/react-github-repo-768x600.png 768w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/react-github-repo-1536x1200.png 1536w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/react-github-repo-2048x1600.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The React Native documentation for Fabric Native Components includes a detailed guide for creating custom components, using &#8220;RTNCenteredText&#8221; as an example. While the documentation is comprehensive and well-maintained, a subtle detail in the package update instructions created an unexpected security vulnerability.<\/p>\n\n\n\n<p>The guide suggests using \u201c<strong>yarn upgrade rtn-centered-text\u201d<\/strong> to update local development packages.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"800\" src=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525932-1024x800.png\" alt=\"guide suggesting using \u201cyarn upgrade rtn-centered-text\u201d to update local development packages.\" class=\"wp-image-99421\" srcset=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525932-1024x800.png 1024w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525932-300x234.png 300w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525932-768x600.png 768w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525932.png 1345w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>However, this command first checks the npm registry for packages before looking at local files. An attacker exploited this behavior by publishing a malicious package with the same name on npm.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"665\" src=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-3061-1024x665.png\" alt=\"malicious package live on npm\" class=\"wp-image-99422\" srcset=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-3061-1024x665.png 1024w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-3061-300x195.png 300w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-3061-768x499.png 768w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-3061-1536x998.png 1536w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-3061-2048x1330.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading article-anchor\" id=\"article-anchor-3\">Community Response and Discovery<\/h2>\n\n\n\n<p>The security issue was first identified by a vigilant community member who submitted a pull request to the React Native documentation repository. The contributor noticed the malicious package on npm while following the documentation guide and immediately raised the alarm. Their quick action in reporting both to npm and the React Native team demonstrates the crucial role that community vigilance plays in maintaining ecosystem security.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"922\" height=\"1024\" src=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525879-922x1024.png\" alt=\"community response\" class=\"wp-image-99423\" srcset=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525879-922x1024.png 922w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525879-270x300.png 270w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525879-768x853.png 768w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525879-1384x1536.png 1384w, https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/Group-11525879-1845x2048.png 1845w\" sizes=\"(max-width: 922px) 100vw, 922px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading article-anchor\" id=\"article-anchor-4\">Impact and Implications<\/h2>\n\n\n\n<p>The implications of this attack extend beyond immediate data exposure. It demonstrates how attackers are becoming increasingly sophisticated in their approach to supply chain attacks. By targeting documentation examples from trusted sources, they exploit the implicit trust developers place in official documentation.<\/p>\n\n\n\n<p>This incident serves as a reminder that supply chain security requires vigilance at every level. Documentation must be precise about package management commands, developers need to verify package sources, and security tools should monitor for packages that may be impersonating official examples.<\/p>\n\n\n\n<p>When working with package managers and following documentation, it is recommended for developers to use explicit paths when adding local packages. Instead of using \u201c<strong>yarn upgrade\u201d<\/strong>, use<br><strong>\u201cyarn add ..\/package-name\u201d<\/strong> to ensure you&#8217;re referencing local development packages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading article-anchor\" id=\"article-anchor-5\">Conclusion<\/h2>\n\n\n\n<p>This incident highlights the principle &#8220;trust but verify&#8221;. While developers naturally trust official documentation and guides from reputable sources, it&#8217;s crucial to maintain a careful verification process even when following trusted resources. This approach ensures that every component, package, and instruction is validated before implementation, protecting against potential security breaches that might exploit this trust.<\/p>\n\n\n\n<p>The open-source community&#8217;s strength lies in its collaborative approach to identifying and addressing security concerns, but we must remain vigilant.<\/p>\n\n\n\n<p>As part of the\u00a0<a href=\"https:\/\/checkmarx.com\/solutions\/software-supply-chain-security\/?__hstc=144372074.3d7624d0d49a8fe96e70f4aa43f618a1.1731297756896.1732030485303.1732468725848.5&amp;__hssc=144372074.2.1732468725848&amp;__hsfp=3153506750\" target=\"_blank\" rel=\"noreferrer noopener\">Checkmarx Supply Chain Security solution<\/a>, our research team continuously monitors suspicious activities in the open-source software ecosystem. We track and flag &#8220;signals&#8221; that may indicate foul play, including suspicious entry points, and promptly alert our customers to help protect them from potential threats.<\/p>\n\n\n\n<h2 class=\"wp-block-heading article-anchor\" id=\"article-anchor-6\">Packages<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>rtn-centered-text<\/li>\n<\/ul>\n\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>A recent discovery revealed how official documentation can become an unexpected attack vector for supply chain attacks. It happened when an npm package called &#8220;rtn-centered-text&#8221; exploited an example from React Native&#8217;s Fabric Native Components guide in an attempt to trick developers into downloading their package, putting systems at risk. Key Findings The Attack Vector: Documentation [&hellip;]<\/p>\n","protected":false},"author":66,"featured_media":99424,"template":"","zero-category":[1067],"zero-tag":[1068],"class_list":["post-99419","zero-post","type-zero-post","status-publish","has-post-thumbnail","hentry","zero-category-blog","zero-tag-checkmarx-security-research-team"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Malicious NPM Package Exploits React Native Documentation Example - Checkmarx<\/title>\n<meta name=\"description\" content=\"Discover how a malicious npm package exploited React Native&#039;s documentation example, highlighting the importance of supply chain security.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Malicious NPM Package Exploits React Native Documentation Example - Checkmarx\" \/>\n<meta property=\"og:description\" content=\"Discover how a malicious npm package exploited React Native&#039;s documentation example, highlighting the importance of supply chain security.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Checkmarx\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Checkmarx.Source.Code.Analysis\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-03T08:36:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2048\" \/>\n\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@checkmarx\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/\",\"url\":\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/\",\"name\":\"Malicious NPM Package Exploits React Native Documentation Example - Checkmarx\",\"isPartOf\":{\"@id\":\"https:\/\/checkmarx.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png\",\"datePublished\":\"2024-12-08T08:24:32+00:00\",\"dateModified\":\"2025-01-03T08:36:08+00:00\",\"description\":\"Discover how a malicious npm package exploited React Native's documentation example, highlighting the importance of supply chain security.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/#primaryimage\",\"url\":\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png\",\"contentUrl\":\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png\",\"width\":2048,\"height\":1024},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/checkmarx.com\/#website\",\"url\":\"https:\/\/checkmarx.com\/\",\"name\":\"Checkmarx\",\"description\":\"The world runs on code. We secure it.\",\"publisher\":{\"@id\":\"https:\/\/checkmarx.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/checkmarx.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/checkmarx.com\/#organization\",\"name\":\"Checkmarx\",\"url\":\"https:\/\/checkmarx.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/checkmarx.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/02\/logo-dark.svg\",\"contentUrl\":\"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/02\/logo-dark.svg\",\"width\":1,\"height\":1,\"caption\":\"Checkmarx\"},\"image\":{\"@id\":\"https:\/\/checkmarx.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Checkmarx.Source.Code.Analysis\",\"https:\/\/x.com\/checkmarx\",\"https:\/\/www.youtube.com\/user\/CheckmarxResearchLab\",\"https:\/\/www.linkedin.com\/company\/checkmarx\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Malicious NPM Package Exploits React Native Documentation Example - Checkmarx","description":"Discover how a malicious npm package exploited React Native's documentation example, highlighting the importance of supply chain security.","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:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/","og_locale":"en_US","og_type":"article","og_title":"Malicious NPM Package Exploits React Native Documentation Example - Checkmarx","og_description":"Discover how a malicious npm package exploited React Native's documentation example, highlighting the importance of supply chain security.","og_url":"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/","og_site_name":"Checkmarx","article_publisher":"https:\/\/www.facebook.com\/Checkmarx.Source.Code.Analysis","article_modified_time":"2025-01-03T08:36:08+00:00","og_image":[{"width":2048,"height":1024,"url":"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@checkmarx","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/","url":"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/","name":"Malicious NPM Package Exploits React Native Documentation Example - Checkmarx","isPartOf":{"@id":"https:\/\/checkmarx.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/#primaryimage"},"image":{"@id":"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/#primaryimage"},"thumbnailUrl":"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png","datePublished":"2024-12-08T08:24:32+00:00","dateModified":"2025-01-03T08:36:08+00:00","description":"Discover how a malicious npm package exploited React Native's documentation example, highlighting the importance of supply chain security.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/checkmarx.com\/blog\/malicious-npm-package-exploits-react-native-documentation-example\/#primaryimage","url":"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png","contentUrl":"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/11\/thumbnail-1.png","width":2048,"height":1024},{"@type":"WebSite","@id":"https:\/\/checkmarx.com\/#website","url":"https:\/\/checkmarx.com\/","name":"Checkmarx","description":"The world runs on code. We secure it.","publisher":{"@id":"https:\/\/checkmarx.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/checkmarx.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/checkmarx.com\/#organization","name":"Checkmarx","url":"https:\/\/checkmarx.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/checkmarx.com\/#\/schema\/logo\/image\/","url":"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/02\/logo-dark.svg","contentUrl":"https:\/\/checkmarx.com\/wp-content\/uploads\/2024\/02\/logo-dark.svg","width":1,"height":1,"caption":"Checkmarx"},"image":{"@id":"https:\/\/checkmarx.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Checkmarx.Source.Code.Analysis","https:\/\/x.com\/checkmarx","https:\/\/www.youtube.com\/user\/CheckmarxResearchLab","https:\/\/www.linkedin.com\/company\/checkmarx"]}]}},"_links":{"self":[{"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/zero-post\/99419","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/zero-post"}],"about":[{"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/types\/zero-post"}],"author":[{"embeddable":true,"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/users\/66"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/media\/99424"}],"wp:attachment":[{"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/media?parent=99419"}],"wp:term":[{"taxonomy":"zero-category","embeddable":true,"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/zero-category?post=99419"},{"taxonomy":"zero-tag","embeddable":true,"href":"https:\/\/checkmarx.com\/wp-json\/wp\/v2\/zero-tag?post=99419"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}