{"id":108,"date":"2016-03-14T00:18:30","date_gmt":"2016-03-14T00:18:30","guid":{"rendered":"http:\/\/eventlogxp.com\/blog\/?p=108"},"modified":"2016-03-13T15:40:17","modified_gmt":"2016-03-13T15:40:17","slug":"forensics-and-benfords-law","status":"publish","type":"post","link":"https:\/\/eventlogxp.com\/blog\/forensics-and-benfords-law\/","title":{"rendered":"Forensics and Benford&#8217;s Law"},"content":{"rendered":"<p>As a producer of digital forensic software, we are regularly learning more about forensic methods and tasks. Recently I came across a curious article (and video) in Business Insider\u00a0called &#8220;<a href=\"http:\/\/www.businessinsider.com\/benfords-law-used-detect-fraud-math-forensic-accountants-2016-2\" target=\"_blank\">How forensic accountants use Benford&#8217;s Law to detect fraud<\/a>&#8221;<\/p>\n<p>The video states that forensic guys can use Benford&#8217;s Law to analyze financial data and identify red flags.<\/p>\n<p>This sounds interesting because it is too easy to check if a set of data obeys this law. Let&#8217;s do some checks.<\/p>\n<p>Benford&#8217;s Law is a phenomenological law about the frequency distribution of leading digits in many real-life sets of numerical data. Mathematically it can be written as<a href=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-formula.jpg\" rel=\"attachment wp-att-109\" data-rel=\"lightbox-gallery-Y88LWTLB\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"size-full wp-image-109 aligncenter\" src=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-formula.jpg\" alt=\"benford law for forensics - formula\" width=\"183\" height=\"74\" \/><\/a>d \u2013 the leading digit<br \/>\nP(d) \u2013 probability that a number begins with d.<\/p>\n<p>For d from 1 to 9, we can calculate probabilities as follows:<br \/>\n<a href=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/Bendord-P.png\" rel=\"attachment wp-att-110\" data-rel=\"lightbox-gallery-Y88LWTLB\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-110\" src=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/Bendord-P-300x131.png\" alt=\"Bendord Law for forensics - original chart\" width=\"300\" height=\"131\" srcset=\"https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/Bendord-P-300x131.png 300w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/Bendord-P.png 496w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>It is stated in the article that Benford&#8217;s Law works good for values which are results of multiplication, division and raising to a power, which are common for financial calculations.<\/p>\n<p>Microsoft Excel helps us to verify this with no efforts. I will multiply 2 random values and divide it to another random value: RANDBETWEEN(1,99)* RANDBETWEEN(1,99)\/ RANDBETWEEN(1,99)<\/p>\n<p>and calculate the distribution for 500 values.<\/p>\n<p><a href=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-rand.jpg\" rel=\"attachment wp-att-111\" data-rel=\"lightbox-gallery-Y88LWTLB\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-111\" src=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-rand-300x133.jpg\" alt=\"benford law for forensics - random values\" width=\"300\" height=\"133\" srcset=\"https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-rand-300x133.jpg 300w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-rand-768x340.jpg 768w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-rand-660x292.jpg 660w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-rand.jpg 972w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><br \/>\n<\/a>Great! This really looks like Benford&#8217;s Law distribution. And this may really help in forensic investigation when analyzing calculated values. If you are interested how I extracted the first digit from a number \u2013 it&#8217;s very easy:<br \/>\nNUMBERVALUE(LEFT(TEXT(A2,0),1))<\/p>\n<p>But the article&#8217;s video starts from the statement that the population of every US county obeys to this law as well. Although I understand, that we can predict demographic values using math formulas, this sounds weird. Since the population of US obeys to this law, I guess this should work for the world population. Let&#8217;s check it.<\/p>\n<p>I was skeptical about the result, but it really looks like Bedford&#8217;s Law distribution!<\/p>\n<p><a href=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-world.jpg\" rel=\"attachment wp-att-112\" data-rel=\"lightbox-gallery-Y88LWTLB\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-112\" src=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-world-300x129.jpg\" alt=\"benford law - world population\" width=\"300\" height=\"129\" srcset=\"https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-world-300x129.jpg 300w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-world-768x330.jpg 768w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-world-660x284.jpg 660w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benford-world.jpg 973w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><br \/>\n<\/a>Ok, if it works with population, maybe it will work with similar entities, but specific to digital forensics. First, I thought about event logs, e.g. number of events in the log. But obviously it won&#8217;t work, because event logs are limited by size. In my example, when the event log grows,\u00a0\u00a0the first digit will be always &#8216;2&#8217; till you clear the log.<\/p>\n<p><a href=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/eventlog-size.jpg\" rel=\"attachment wp-att-118\" data-rel=\"lightbox-gallery-Y88LWTLB\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"alignnone size-medium wp-image-118\" src=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/eventlog-size-273x300.jpg\" alt=\"Event logs limited by size\" width=\"273\" height=\"300\" srcset=\"https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/eventlog-size-273x300.jpg 273w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/eventlog-size.jpg 384w\" sizes=\"(max-width: 273px) 100vw, 273px\" \/><br \/>\n<\/a><span style=\"line-height: 1.5;\">Moreover, Windows commonly uses only few event logs, so we won&#8217;t\u00a0get any statistical significance. And of course Benford&#8217;s Law\u00a0won&#8217;t work if we test Event ID numbers \u2013 they have solely artificial nature and it&#8217;s up to developer to choose an identifier for event.<\/span><\/p>\n<p>But what about files. What if we test it with file size \u2013 will it work? If it works for test samples, we will be able to suppose that if the investigation case \u00a0files don&#8217;t obey the law, someone could remove many files. I will test it with C:\\Windows folder and its subfolders on my PC (it contains more than 100 000 files). By the way, since Windows keeps event log files in C:\\Windows\\System32\\winevt\\Logs and these files are limited by size, it may affect the statistics. Hopefully there are only about 150 files in Logs folder, so this effect is not significant. We will take size of every file in kilobytes.<\/p>\n<p><a href=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-files.jpg\" rel=\"attachment wp-att-113\" data-rel=\"lightbox-gallery-Y88LWTLB\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"size-medium wp-image-113 alignnone\" src=\"http:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-files-300x125.jpg\" alt=\"benford law for forensics - files sizes in Windows folder\" width=\"300\" height=\"125\" srcset=\"https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-files-300x125.jpg 300w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-files-768x321.jpg 768w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-files-660x276.jpg 660w, https:\/\/eventlogxp.com\/blog\/wp-content\/uploads\/2016\/03\/benfordlaw-files.jpg 982w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><br \/>\n<\/a>Well, it is really similar to Benford&#8217;s Law distribution. But one sample is not enough to make conclusions.\u00a0It is interesting\u00a0that\u00a0in all my cases, we can see a small hump at 7 or 8 digits.<\/p>\n<p>Let us summarize what we researched here. Benford&#8217;s Law works for big volumes of data that are the result of certain calculations, like financial results. It works with some statistical data. It may work for some specific digital data \u2013 although my test shows that it works for file size, it should be rechecked with other sets of data. Probably it will work with other digital data which digital forensic investigator may get as evidence. However this method won&#8217;t work for neat frauds. If only a small part of data modified, the distribution won&#8217;t show any significant deviation. In case of financial fraud, if a malefactor modified the original data and recalculate all the results, I suppose that the new set of data will obey the law.<\/p>\n<p>Therefore, as any forensic instrument, Benford&#8217;s Law has its own applications, but it is not a panacea.<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-facebook nolightbox\" data-provider=\"facebook\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Facebook\" href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F108&#038;t=Forensics%20and%20Benford%E2%80%99s%20Law&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F108&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-content%2Fuploads%2F2016%2F03%2Fbenford-forensics.jpg&#038;p&#091;title&#093;=Forensics%20and%20Benford%E2%80%99s%20Law\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img alt=\"Facebook\" title=\"Share on Facebook\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none\" src=\"https:\/\/eventlogxp.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/facebook.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F108&#038;text=Check%20this%20Event%20Log%20Explorer%20blog%20post\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none\" src=\"https:\/\/eventlogxp.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-reddit nolightbox\" data-provider=\"reddit\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Reddit\" href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F108&#038;title=Forensics%20and%20Benford%E2%80%99s%20Law\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img alt=\"reddit\" title=\"Share on Reddit\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none\" src=\"https:\/\/eventlogxp.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/reddit.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-pinterest nolightbox\" data-provider=\"pinterest\" target=\"_blank\" rel=\"nofollow\" title=\"Pin it with Pinterest\" href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F108&#038;media=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-content%2Fuploads%2F2016%2F03%2Fbenford-forensics.jpg&#038;description=Forensics%20and%20Benford%E2%80%99s%20Law\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img alt=\"pinterest\" title=\"Pin it with Pinterest\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none\" src=\"https:\/\/eventlogxp.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/pinterest.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&#038;url=https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F108&#038;title=Forensics%20and%20Benford%E2%80%99s%20Law\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px;margin-right:5px\"><img alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none\" src=\"https:\/\/eventlogxp.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/linkedin.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-24 synved-social-resolution-single synved-social-provider-mail nolightbox\" data-provider=\"mail\" rel=\"nofollow\" title=\"Share by email\" href=\"mailto:?subject=Forensics%20and%20Benford%E2%80%99s%20Law&#038;body=Check%20this%20Event%20Log%20Explorer%20blog%20post:%20https%3A%2F%2Feventlogxp.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F108\" style=\"font-size: 0px;width:24px;height:24px;margin:0;margin-bottom:5px\"><img alt=\"mail\" title=\"Share by email\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"24\" height=\"24\" style=\"display: inline;width:24px;height:24px;margin: 0;padding: 0;border: none\" src=\"https:\/\/eventlogxp.com\/blog\/wp-content\/plugins\/social-media-feather\/synved-social\/image\/social\/regular\/48x48\/mail.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>As a producer of digital forensic software, we are regularly learning more about forensic methods and tasks. Recently I came across a curious article (and video) in Business Insider\u00a0called &#8220;How forensic accountants use Benford&#8217;s Law to detect fraud&#8221; The video states that forensic guys can use Benford&#8217;s Law to analyze financial data and identify red flags. This sounds interesting because it is too easy to\u2026 <span class=\"read-more\"><a href=\"https:\/\/eventlogxp.com\/blog\/forensics-and-benfords-law\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":115,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[40],"tags":[51],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/posts\/108"}],"collection":[{"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":4,"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":119,"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions\/119"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/media\/115"}],"wp:attachment":[{"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eventlogxp.com\/blog\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}