{
  "WorkItem": {
    "AffectedComponent": {
      "Name": "",
      "DisplayName": ""
    },
    "ClosedComment": "",
    "ClosedDate": null,
    "CommentCount": 0,
    "Custom": null,
    "Description": "The random number generator implemented by NextBytes() cannot withstand a cryptographic attack.\n\nRecommedation:\nThe .NET framework provides a cryptographic PRNG in System.Security.Cryptography.RandomNumberGenerator. \n\nExplanation:\n\nInsecure randomness errors occur when a function that can produce predictable values is used as a source of randomness in security-sensitive context.\n\nIn this case the function that generates weak random numbers is NextBytes() in WinZipAes.cs at line 82.\n\nComputers are deterministic machines, and as such are unable to produce true randomness. Pseudorandom Number Generators (PRNGs) approximate randomness algorithmically, starting with a seed from which subsequent values are calculated.\n\nThere are two types of PRNGs: statistical and cryptographic. Statistical PRNGs provide useful statistical properties, but their output is highly predictable and forms an easy to reproduce numeric stream that is unsuitable for use in cases where security depends on generated values being unpredictable. Cryptographic PRNGs address this problem by generating output that is more difficult to predict. For a value to be cryptographically secure, it must be impossible or highly improbable for an attacker to distinguish between it and a truly random value. In general, if a PRNG algorithm is not advertised as being cryptographically secure, then it is probably a statistical PRNG and should not be used in security-sensitive contexts, where its use can lead to serious vulnerabilities such as easy-to-guess temporary passwords, predictable cryptographic keys, session hijacking, and DNS spoofing.\n\n```\n  public static WinZipAesCrypto Generate(string password, int KeyStrengthInBits)\n        {\n            WinZipAesCrypto c = new WinZipAesCrypto(password, KeyStrengthInBits);\n\n            int saltSizeInBytes = c._KeyStrengthInBytes / 2;\n            c._Salt = new byte[saltSizeInBytes];\n            Random rnd = new Random();\n            rnd.NextBytes(c._Salt);\n            return c;\n        }\n```",
    "LastUpdatedDate": "2015-09-02T05:00:16.15-07:00",
    "PlannedForRelease": "",
    "ReleaseVisibleToPublic": false,
    "Priority": {
      "Name": "Unassigned",
      "Severity": 0,
      "Id": 0
    },
    "ProjectName": "DotNetZip",
    "ReportedDate": "2015-09-02T05:00:16.15-07:00",
    "Status": {
      "Name": "Proposed",
      "Id": 1
    },
    "ReasonClosed": {
      "Name": "Unassigned"
    },
    "Summary": "Insecure Randomness in WinZipAES",
    "Type": {
      "Name": "Unassigned",
      "Id": 5
    },
    "VoteCount": 1,
    "Id": 17506
  },
  "FileAttachments": [],
  "Comments": []
}